Exemplo n.º 1
0
        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"));
        }
Exemplo n.º 2
0
 public ChitSubscriber Get(Guid id)
 {
     return(_subscribeService.Find(id));
 }