public IActionResult Delete(string id) { string userId = this.GetUserId(); var rs = _iHolidayService.Delete(id, userId); return(Ok(rs)); }
public HttpResponseMessage Delete(HttpRequestMessage request, int id) { var holiday = _holidayService.GetById(id); if (holiday == null) { return(request.CreateResponse(HttpStatusCode.BadRequest, MessageSystem.ERROR_DELETE_NOT_FOUND)); } if (holiday.Date.Date < DateTime.Now.Date || (holiday.Workingday.HasValue && holiday.Workingday.Value.Date < DateTime.Now.Date)) { return(request.CreateResponse(HttpStatusCode.BadRequest, MessageSystem.ERROR_DELETE_INTHE_PAST)); } _requestService.HandleDeleteHoliday(holiday); _holidayService.Delete(id); _holidayService.Save(); return(request.CreateResponse(HttpStatusCode.OK, id)); }
public ActionResult Delete(long?id) { if (id != null) { var holiday = _holService.GetByID(id.Value); _holService.Delete(id.Value); TempData["Delete"] = "true"; var list = _vacreqService.CheckUsersHaveVacation(holiday.Date); foreach (var item in list) { _mutvacService.SubtractMinutes(item.UserID, SecurityHelper.GetUserId(), item.TotalMinutes); } return(RedirectToAction("Index", "Holiday")); } return(RedirectToAction("Index", "Holiday")); }
public ActionResult Save(int?id, FormCollection actionValues) { var action = new DataAction(actionValues); try { var changedEvent = DHXEventsHelper.Bind <HolidayVM>(actionValues); holiday h = new holiday { holidayId = changedEvent.holidayId, startDate = changedEvent.startDate, endDate = changedEvent.endDate, name = changedEvent.name }; switch (action.Type) { case DataActionTypes.Insert: hs.Add(h); hs.Commit(); break; case DataActionTypes.Delete: hs.Delete(holiday => holiday.holidayId == changedEvent.holidayId); hs.Commit(); break; case DataActionTypes.Update: hs.Update(h); hs.Commit(); break; default: break; } action.TargetId = changedEvent.holidayId; } catch (Exception a) { action.Type = DataActionTypes.Error; } return(new AjaxSaveResponse(action)); }
// DELETE: api/Holidays/5 public void Delete(int id) { _holidayService.Delete(id); }