public ActionResult DeleteVolunteerDoctor(int id) { try { var result = _volunteerDoctorService.Delete(id); var result2 = _userService.Delete(id); var assign = _assignedRequest.GetDoctorAll(id); foreach (var p in assign.Data) { _assignedRequest.Delete(p.AssignedId); } var workShop = _assignworkShopService.GetAllByUserId(id); foreach (var p in workShop.Data) { _assignworkShopService.Delete(p.AssignWorkShopId); } var notification = _notificationService.GetAllByUserId(id); foreach (var p in notification.Data) { _notificationService.Delete(p.NotificationId); } return(RedirectToAction("GetAllVolunteerDoctor")); } catch (Exception e) { return(Content(e.Message)); } }
public ActionResult DeleteWorkShop(int id) { try { var result = _workshopService.Delete(id); var result2 = _assignworkShopService.GetAllByWorkShopId(id); foreach (var p in result2.Data) { _assignworkShopService.Delete(p.AssignWorkShopId); var result4 = _volunteerService.GetById(p.UserId); // result4.Data.WorkShopStatus = "false"; var result3 = _volunteerService.Save(result4.Data); } return(RedirectToAction("GetAllWorkShop")); } catch (Exception e) { return(Content(e.Message)); } }