Changeset 2639fab for PostgreSqlDotnetCore
- Timestamp:
- 08/14/24 16:27:55 (3 months ago)
- Branches:
- main
- Children:
- ae6c071
- Parents:
- 784b3ad
- Location:
- PostgreSqlDotnetCore
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
PostgreSqlDotnetCore/Controllers/BlogController.cs
r784b3ad r2639fab 60 60 public ActionResult Create() 61 61 { 62 var model = new BlogPostConsultation 63 { 64 //date_askes = DateTime.Now // Поставете го датумот на моменталниот датум 65 // date_askes= DateTime.UtcNow.Date 66 date_askes = DateOnly.FromDateTime(DateTime.UtcNow.Date) 67 }; 62 var model = new BlogPostConsultation(); 68 63 return View(model); 69 64 } … … 83 78 var user = await _userManager.GetUserAsync(User); 84 79 var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); 85 // blogClass.date_askes = new DateTime();86 // blogClass.date_askes = DateTime.UtcNow;87 blogClass.date_askes = DateOnly.FromDateTime(DateTime.UtcNow);88 80 blogClass.users_id = customerClass.id; 89 81 db.BlogPostControllerObj.Add(blogClass); -
PostgreSqlDotnetCore/Controllers/ProductsController.cs
r784b3ad r2639fab 2 2 using Microsoft.AspNetCore.Mvc; 3 3 using Microsoft.EntityFrameworkCore; 4 using Npgsql; 5 using System.Linq; 4 6 using PostgreSqlDotnetCore.Models; 5 using System.Net; 7 //using System.Net; 8 using System.Threading.Tasks; 9 using PostgreSqlDotnetCore.Data; 6 10 7 11 namespace PostgreSqlDotnetCore.Controllers … … 9 13 public class ProductsController : BaseController 10 14 { 15 11 16 public ProductsController(UserManager<IdentityUser> userManager) : base(userManager) 12 17 { … … 68 73 var model = new ProductsClass 69 74 { 70 dateadded = DateTime.Now // Поставете го датумот на моменталниот датум75 // dateadded = DateTime.Now // Поставете го датумот на моменталниот датум 71 76 }; 72 77 return View(model); 73 78 } 79 80 81 74 82 75 83 // POST: Customer/Create … … 78 86 [HttpPost] 79 87 [ValidateAntiForgeryToken] 80 public ActionResult Create([Bind(include: "id,name,description,price, is_active, dateadded, category ")] ProductsClass prodClass)88 public ActionResult Create([Bind(include: "id,name,description,price, is_active, dateadded, category, int available_quantity")] ProductsClass prodClass) 81 89 { 82 90 if (ModelState.IsValid) 83 91 { 84 prodClass.dateadded = new DateTime();92 // prodClass.dateadded = new DateTime(); 85 93 prodClass.isactive = true; 86 94 db.ProductObj.Add(prodClass); … … 91 99 return View(prodClass); 92 100 } 101 102 103 104 105 106 107 108 109 110 93 111 94 112 // GET: Customer/Edit/5 … … 117 135 [HttpPost] 118 136 [ValidateAntiForgeryToken] 119 public ActionResult Edit([Bind(include: "id,name,description,price, is_active, dateadded, category ")] ProductsClass prodClass)137 public ActionResult Edit([Bind(include: "id,name,description,price, is_active, dateadded, category, int available_quantity")] ProductsClass prodClass) 120 138 { 121 139 if (ModelState.IsValid) -
PostgreSqlDotnetCore/Data/ApplicationDbContext.cs
r784b3ad r2639fab 51 51 modelBuilder.Entity<BlogPostAnswers>().Metadata.SetIsTableExcludedFromMigrations(true); 52 52 //modelBuilder.Entity<PetCareAllData>().Metadata.SetIsTableExcludedFromMigrations(true); 53 54 55 53 56 base.OnModelCreating(modelBuilder); 54 57 58 // Configure the relationship between VetCenter and CitiesClass 59 60 61 55 62 // ... model definition ... 56 63 } -
PostgreSqlDotnetCore/Models/ProductsClass.cs
r784b3ad r2639fab 19 19 public string price { get; set; } 20 20 public bool isactive { get; set; } 21 public DateTime dateadded { get; set; } 21 //public DateTime dateadded { get; set; } 22 23 public DateOnly dateadded { get; set; } = DateOnly.FromDateTime(DateTime.UtcNow); 22 24 public string category { get; set; } 23 25 26 public int available_quantity { get; set; } 27 24 28 25 29 } -
PostgreSqlDotnetCore/Models/VetCenter.cs
r784b3ad r2639fab 24 24 public float longitude { get; set; } 25 25 public string phonenumber { get; set; } 26 // [ForeignKey("CitiesClass")] 26 27 public int citiesid { get; set; } 28 // public CitiesClass CitiesClass { get; set; } 27 29 28 30 -
PostgreSqlDotnetCore/Program.cs
r784b3ad r2639fab 2 2 using Microsoft.EntityFrameworkCore; 3 3 using PostgreSqlDotnetCore.Data; 4 using PostgreSqlDotnetCore.Models; 4 5 5 6 var builder = WebApplication.CreateBuilder(args); -
PostgreSqlDotnetCore/Views/Products/Create.cshtml
r784b3ad r2639fab 48 48 </div> 49 49 </div> 50 51 <div class="form-group"> 52 @Html.LabelFor(model => model.available_quantity, htmlAttributes: new { @class = "control-label col-md-2" }) 53 <div class="col-md-10"> 54 @Html.EditorFor(model => model.available_quantity, new { htmlAttributes = new { @class = "form-control" } }) 55 <span class="input-group-addon">euro</span> 56 @Html.ValidationMessageFor(model => model.available_quantity, "", new { @class = "text-danger" }) 57 </div> 58 </div> 59 50 60 @*<div class="form-group"> 51 61 @Html.LabelFor(model => model.category, htmlAttributes: new { @class = "control-label col-md-2" }) … … 57 67 58 68 <div class="form-group"> 59 <label for="category"> Jobs:</label>69 <label for="category">Category:</label> 60 70 <select class="form-control" id="category" name="category"> 61 71 <option value="">Select category</option> -
PostgreSqlDotnetCore/Views/Products/Delete.cshtml
r784b3ad r2639fab 56 56 </dd> 57 57 58 <dt> 59 @Html.DisplayNameFor(model => model.available_quantity) 60 </dt> 61 62 <dd> 63 @Html.DisplayFor(model => model.available_quantity) 64 </dd> 65 58 66 59 67 </dl> -
PostgreSqlDotnetCore/Views/Products/Details.cshtml
r784b3ad r2639fab 55 55 </dd> 56 56 57 <dt> 58 @Html.DisplayNameFor(model => model.available_quantity) 59 </dt> 60 61 <dd> 62 @Html.DisplayFor(model => model.available_quantity) 63 </dd> 64 57 65 </dl> 58 66 </div> -
PostgreSqlDotnetCore/Views/Products/Edit.cshtml
r784b3ad r2639fab 54 54 </div> 55 55 </div> 56 <div class="form-group"> 57 @Html.LabelFor(model => model.available_quantity, htmlAttributes: new { @class = "control-label col-md-2" }) 58 <div class="col-md-10"> 59 @Html.EditorFor(model => model.available_quantity, new { htmlAttributes = new { @class = "form-control" } }) 60 @Html.ValidationMessageFor(model => model.available_quantity, "", new { @class = "text-danger" }) 61 </div> 62 </div> 56 63 57 64 <div class="form-group">
Note:
See TracChangeset
for help on using the changeset viewer.