public virtual ActionResult GetLikelyThief(LikelyThief likelyThief)
        {
            SetNavigationHierarchy(GetLikelyThiefNavigationItems(likelyThief));

            var getLikelyThiefViewModel = new GetLikelyThiefViewModel(
                likelyThief, HasRightToEditLikelyThief(likelyThief));

            return View(getLikelyThiefViewModel);
        }
        public virtual ActionResult AddLikelyThief(AddLikelyThiefFormViewModel form)
        {
            return Handle(
                () =>
                {
                    var likelyThief = new LikelyThief(UserIdOrDefault, UserNameOrDefault, LikelyThiefStatus.Added,
                                                      form.Name, form.Position, form.Description);

                    _documentSession.Store(likelyThief);
                },
                success: () => MVC.LieDetectorOrThief.LikelyThief.Index());
        }
        public virtual ActionResult EditLikelyThief(LikelyThief likelyThief)
        {
            SetNavigationHierarchy(GetLikelyThiefNavigationItems(likelyThief), "Редактировать");

            var hasRightToEdit = HasRightToEditLikelyThief(likelyThief);
            if (!hasRightToEdit)
                return RedirectToAction(MVC.Home.Index());

            var form = new EditLikelyThiefFormViewModel(
                likelyThief.Name, likelyThief.Position, likelyThief.Description);

            return View(form);
        }
        public virtual ActionResult EditLikelyThief(LikelyThief likelyThief, EditLikelyThiefFormViewModel form)
        {
            return Handle(() =>
                              {
                                  var hasRightToEdit = HasRightToEditLikelyThief(likelyThief);
                                  if (!hasRightToEdit)
                                      throw new SecurityAccessDeniedException();

                                  likelyThief.Name = form.Name;
                                  likelyThief.Position = form.Position;
                                  likelyThief.Description = form.Description;

                                  _documentSession.Store(likelyThief);
                              },
            success: () => MVC.LieDetectorOrThief.LikelyThief.GetLikelyThief());
        }
 private IEnumerable<NavigationItem> GetLikelyThiefNavigationItems(LikelyThief likelyThief)
 {
     return new List<NavigationItem>(GetLikelyThievesNavigationItems())
                {
                    new NavigationItem(likelyThief.Name, MVC.LieDetectorOrThief.LikelyThief.GetLikelyThief(likelyThief))
                };
 }
 private bool HasRightToEditLikelyThief(LikelyThief likelyThief)
 {
     var hasRightToEditLikelyThiefSuggestion = UserIdOrDefault != null && likelyThief.UserId == UserIdOrDefault;
     return hasRightToEditLikelyThiefSuggestion;
 }
        public virtual ActionResult SwitchLikelyThiefStatus(LikelyThief likelyThief, LikelyThiefStatus status)
        {
            return Handle(() =>
                              {
                                  likelyThief.Status = status;

                                  _documentSession.Store(likelyThief);
                              });
        }