Ignore:
Timestamp:
08/14/24 16:27:55 (3 months ago)
Author:
ElenaMoskova <elena.moskova99@…>
Branches:
main
Children:
ae6c071
Parents:
784b3ad
Message:

Update with triggers

Location:
PostgreSqlDotnetCore/Controllers
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • PostgreSqlDotnetCore/Controllers/BlogController.cs

    r784b3ad r2639fab  
    6060        public ActionResult Create()
    6161        {
    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();
    6863            return View(model);
    6964        }
     
    8378                    var user = await _userManager.GetUserAsync(User);
    8479                    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);
    8880                    blogClass.users_id = customerClass.id;
    8981                    db.BlogPostControllerObj.Add(blogClass);
  • PostgreSqlDotnetCore/Controllers/ProductsController.cs

    r784b3ad r2639fab  
    22using Microsoft.AspNetCore.Mvc;
    33using Microsoft.EntityFrameworkCore;
     4using Npgsql;
     5using System.Linq;
    46using PostgreSqlDotnetCore.Models;
    5 using System.Net;
     7//using System.Net;
     8using System.Threading.Tasks;
     9using PostgreSqlDotnetCore.Data;
    610
    711namespace PostgreSqlDotnetCore.Controllers
     
    913    public class ProductsController : BaseController
    1014    {
     15
    1116        public ProductsController(UserManager<IdentityUser> userManager) : base(userManager)
    1217        {
     
    6873            var model = new ProductsClass
    6974            {
    70                 dateadded = DateTime.Now // Поставете го датумот на моменталниот датум
     75              //  dateadded = DateTime.Now // Поставете го датумот на моменталниот датум
    7176            };
    7277            return View(model);
    7378        }
     79
     80
     81
    7482
    7583        // POST: Customer/Create
     
    7886        [HttpPost]
    7987        [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)
    8189        {
    8290            if (ModelState.IsValid)
    8391            {
    84                 prodClass.dateadded = new DateTime();
     92              //  prodClass.dateadded = new DateTime();
    8593                prodClass.isactive = true;
    8694                db.ProductObj.Add(prodClass);
     
    9199            return View(prodClass);
    92100        }
     101
     102
     103
     104
     105
     106
     107
     108
     109
     110
    93111
    94112        // GET: Customer/Edit/5
     
    117135        [HttpPost]
    118136        [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)
    120138        {
    121139            if (ModelState.IsValid)
Note: See TracChangeset for help on using the changeset viewer.