Ignore:
Timestamp:
08/15/24 20:01:13 (3 months ago)
Author:
ElenaMoskova <elena.moskova99@…>
Branches:
main
Children:
8f8226c
Parents:
2639fab
Message:

Аutomating the process

automating the process of updating the list of veterinary centers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • PostgreSqlDotnetCore/Controllers/PetCaresController.cs

    r2639fab rae6c071  
    22using Microsoft.AspNetCore.Mvc;
    33using Microsoft.EntityFrameworkCore;
     4using Microsoft.AspNetCore.Mvc.Rendering;
    45using PostgreSqlDotnetCore.Models;
    56using System;
     
    1415        }
    1516
     17
     18        [HttpGet]
     19        public async Task<ActionResult> Create()
     20        {
     21           
     22            var vetCenters = await db.VetCentersObj.ToListAsync();
     23
     24            ViewBag.VetCenters = new SelectList(vetCenters, "id", "name");
     25
     26            return View();
     27        }
     28
    1629        // GET: Customer
    1730        public async Task<ActionResult> IndexAsync()
     
    8396        //}
    8497
    85         public ActionResult Create()
     98        /*public ActionResult Create()
    8699        {
    87100           
    88101            return View();
    89         }
     102        }*/
    90103
    91104        // POST: Customer/Create
     
    94107        [HttpPost]
    95108        [ValidateAntiForgeryToken]
    96         public async Task<ActionResult> CreateAsync([Bind(include: "id,title,description,dateending, usersid, vetcentersid")] Pet_CaresClass peClass)
     109        public async Task<ActionResult> CreateAsync([Bind(include: "id,title,description,dateending, start_date, usersid, vetcentersid")] Pet_CaresClass peClass)
    97110        {
    98111            bool isAuthenticated = User.Identity.IsAuthenticated;
     
    104117            {
    105118                peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc);
     119                peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc);
    106120                var user = await _userManager.GetUserAsync(User);
    107121                var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);
     
    135149        [HttpPost]
    136150        [ValidateAntiForgeryToken]
    137         public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, vetcentersid")] Pet_CaresClass peClass)
     151        public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, start_date vetcentersid")] Pet_CaresClass peClass)
    138152        {
    139153            bool isAuthenticated = User.Identity.IsAuthenticated;
     
    146160            {
    147161                peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc);
     162                peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc);
    148163                var user = await _userManager.GetUserAsync(User);
    149164                var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);
Note: See TracChangeset for help on using the changeset viewer.