コード例 #1
0
ファイル: UserController.cs プロジェクト: netsh3r/ng-project
        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"));
        }
コード例 #2
0
 public async Task <ServiceResponse <SubscribeDto> > Delete(int id, int userId)
 {
     return(_repository.Delete(id, userId));
 }