Ignore:
Timestamp:
08/20/24 15:04:19 (6 weeks ago)
Author:
ElenaMoskova <elena.moskova99@…>
Branches:
main
Children:
6782104
Parents:
ae6c071
Message:

fix bugs and new pages

Fix BlogPostAnswers
fix present data in the lists

File:
1 edited

Legend:

Unmodified
Added
Removed
  • PostgreSqlDotnetCore/Controllers/PetCaresController.cs

    rae6c071 r8f8226c  
    130130
    131131        // GET: Customer/Edit/5
    132         public ActionResult Edit(int? id)
     132        /*  public ActionResult Edit(int? id)
     133          {
     134              if (id == null)
     135              {
     136                  return RedirectToAction("NotExist", "Error");
     137              }
     138              Pet_CaresClass peClass = db.PetCaresObj.Find(id);
     139              if (peClass == null)
     140              {
     141                  return RedirectToAction("NotExist", "Error");
     142              }
     143
     144
     145              return View(peClass);
     146          }*/
     147        // GET: Customer/Edit/5
     148        /* public  ActionResult Edit(int? id)
     149         {
     150             if (id == null)
     151             {
     152                 return RedirectToAction("NotExist", "Error");
     153             }
     154             Pet_CaresClass peClass = db.PetCaresObj.Find(id);
     155             if (peClass == null)
     156             {
     157                 return RedirectToAction("NotExist", "Error");
     158             }
     159
     160
     161             return View(peClass);
     162         }*/
     163        public async Task<ActionResult> Edit(int? id)
    133164        {
    134165            if (id == null)
     
    136167                return RedirectToAction("NotExist", "Error");
    137168            }
    138             Pet_CaresClass peClass = db.PetCaresObj.Find(id);
     169
     170            Pet_CaresClass peClass = await db.PetCaresObj.FindAsync(id);
    139171            if (peClass == null)
    140172            {
    141173                return RedirectToAction("NotExist", "Error");
    142174            }
    143             return View(peClass);
    144         }
     175
     176            var vetCenters = await db.VetCentersObj.ToListAsync();
     177            ViewBag.VetCenters = new SelectList(vetCenters, "id", "name", peClass.vetcentersid);
     178
     179            return View(peClass);
     180        }
     181
     182
    145183
    146184        // POST: Customer/Edit/5
     
    149187        [HttpPost]
    150188        [ValidateAntiForgeryToken]
    151         public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, start_date vetcentersid")] Pet_CaresClass peClass)
     189        public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, vetcentersid")] Pet_CaresClass peClass)
    152190        {
    153191            bool isAuthenticated = User.Identity.IsAuthenticated;
     
    156194                return RedirectToAction("AccessDenied", "Error");
    157195            }
    158              
     196
    159197            if (ModelState.IsValid)
    160198            {
    161199                peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc);
    162                 peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc);
    163200                var user = await _userManager.GetUserAsync(User);
    164201                var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email);
     
    171208        }
    172209
     210
     211
     212
    173213        // GET: Customer/Delete/5
    174214        public ActionResult Delete(int? id)
Note: See TracChangeset for help on using the changeset viewer.