public ActionResult DiscardRequest(int id) { try { var result = _requestService.Delete(id); var result2 = _assignedRequest.GetAll(id.ToString()); foreach (var p in result2.Data) { _assignedRequest.Delete(p.AssignedId); /* if (p.VolunteerId!=0) * { * var volunteerobj = _volunteerService.GetById(p.VolunteerId); * volunteerobj.Data.IsActive = "true"; * volunteerobj.Data.IsVolunteerDone = "Done"; * var result3 = _volunteerService.Save(volunteerobj.Data); * } * if (p.VolunteerDoctorId != 0) * { * var volunteerobj = _volunteerDoctorService.GetById(p.VolunteerDoctorId); * volunteerobj.Data.IsActive = "true"; * volunteerobj.Data. IsDoctorDone = "Done"; * var result3 = _volunteerDoctorService.Save(volunteerobj.Data); * }*/ } return(RedirectToAction("GetAllRequest", "Request")); } catch (Exception e) { return(Content(e.Message)); } }
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)); } }