Exemplo n.º 1
0
 public ActionResult Delete(int?id)
 {
     try
     {
         var item = DayOffRepository.GetDayOffById(id.Value);
         if (item != null)
         {
             //if (item.CreatedUserId != Erp.BackOffice.Helpers.Common.CurrentUser.Id && Erp.BackOffice.Helpers.Common.CurrentUser.UserTypeId != 1)
             //{
             //    TempData["FailedMessage"] = "NotOwner";
             //    return RedirectToAction("Index");
             //}
             //item.IsDeleted = true;
             //TechniqueRepository.UpdateTechnique(item);
             DayOffRepository.DeleteDayOff(id.Value);
         }
         TempData[Globals.SuccessMessageKey] = App_GlobalResources.Wording.DeleteSuccess;
         return(RedirectToAction("Index"));
     }
     catch (DbUpdateException)
     {
         TempData[Globals.FailedMessageKey] = App_GlobalResources.Error.RelationError;
         return(RedirectToAction("Index"));
     }
 }
Exemplo n.º 2
0
        public HabitResponse DeleteHabit(Guid userId, Guid habitId)
        {
            ValidateUserID(userId, habitId);
            List <String> dayOffs = dayOffRepository.GetDayOffByHabitId(habitId);
            Habit         habit   = habitRepository.DeleteHabit(habitId);

            dayOffRepository.DeleteDayOff(habitId);
            return(ConvertFromHabitToHabitResponseByRemovingDayOff(habit, dayOffs));
        }