- Timestamp:
- 08/20/24 15:04:19 (3 months ago)
- Branches:
- main
- Children:
- 6782104
- Parents:
- ae6c071
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
PostgreSqlDotnetCore/Controllers/PetCaresController.cs
rae6c071 r8f8226c 130 130 131 131 // 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) 133 164 { 134 165 if (id == null) … … 136 167 return RedirectToAction("NotExist", "Error"); 137 168 } 138 Pet_CaresClass peClass = db.PetCaresObj.Find(id); 169 170 Pet_CaresClass peClass = await db.PetCaresObj.FindAsync(id); 139 171 if (peClass == null) 140 172 { 141 173 return RedirectToAction("NotExist", "Error"); 142 174 } 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 145 183 146 184 // POST: Customer/Edit/5 … … 149 187 [HttpPost] 150 188 [ValidateAntiForgeryToken] 151 public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, start_datevetcentersid")] Pet_CaresClass peClass)189 public async Task<ActionResult> EditAsync([Bind(include: "id,title,description,dateending, vetcentersid")] Pet_CaresClass peClass) 152 190 { 153 191 bool isAuthenticated = User.Identity.IsAuthenticated; … … 156 194 return RedirectToAction("AccessDenied", "Error"); 157 195 } 158 196 159 197 if (ModelState.IsValid) 160 198 { 161 199 peClass.dateending = DateTime.SpecifyKind(peClass.dateending, DateTimeKind.Utc); 162 peClass.start_date = DateTime.SpecifyKind(peClass.start_date, DateTimeKind.Utc);163 200 var user = await _userManager.GetUserAsync(User); 164 201 var customerClass = db.CustomerObj.SingleOrDefault(x => x.email == user.Email); … … 171 208 } 172 209 210 211 212 173 213 // GET: Customer/Delete/5 174 214 public ActionResult Delete(int? id)
Note:
See TracChangeset
for help on using the changeset viewer.