Changeset 2639fab for PostgreSqlDotnetCore/Controllers
- Timestamp:
- 08/14/24 16:27:55 (3 months ago)
- Branches:
- main
- Children:
- ae6c071
- Parents:
- 784b3ad
- Location:
- PostgreSqlDotnetCore/Controllers
- Files:
-
- 2 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)
Note:
See TracChangeset
for help on using the changeset viewer.