public IActionResult DeleteUser(int id) { var worker = workerService.Find(t => t.UserId == id); var sub = subscribeService.Find(t => t.UserId == id); if (worker != null) { workerService.Delete(worker.Id); } if (sub != null) { var projects = projectService.FindAll(t => t.UserId == id); foreach (var proj in projects) { projectService.RemoveLink(new ProjectSubscriber() { ProjectsId = proj.Id, SubscribersId = sub.Id }); } subscribeService.Delete(sub.Id); } userService.Delete(id); return(RedirectToAction("All")); }
public async Task <ServiceResponse <SubscribeDto> > Delete(int id, int userId) { return(_repository.Delete(id, userId)); }