Exemple #1
0
        public virtual IActionResult Delete(int id)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageShifts))
            {
                return(AccessDeniedView());
            }

            //try to get a customer role with the specified id
            var shift = _shiftService.GetShiftById(id);

            if (shift == null)
            {
                return(RedirectToAction("List"));
            }

            try
            {
                _shiftService.DeleteShift(shift);

                //activity log
                _customerActivityService.InsertActivity("DeleteShift",
                                                        string.Format(_localizationService.GetResource("ActivityLog.DeleteShift"), shift.Name), shift);

                SuccessNotification(_localizationService.GetResource("Hero.Admin.Shifts.Deleted"));

                return(RedirectToAction("List"));
            }
            catch (Exception exc)
            {
                ErrorNotification(exc.Message);
                return(RedirectToAction("Edit", new { id = shift.Id }));
            }
        }
Exemple #2
0
 public void Delete(int id)
 {
     try
     {
         _ShiftService.DeleteShift(id);
     }
     catch
     {
         throw;
     }
 }
 public ActionResult <Shift> Delete(int id)
 {
     try
     {
         return(Ok(_shiftService.DeleteShift(id)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemple #4
0
 public ActionResult DeleteShift(string shiftID)
 {
     if (string.IsNullOrEmpty(shiftID))
     {
         return(BadRequest(new ReturnMessage("Shift id is not valid")));
     }
     if (_service.DeleteShift(shiftID))
     {
         return(Ok());
     }
     return(BadRequest(new ReturnMessage("Failed to delete shift")));
 }
 public async Task <IActionResult> DeleteShift(int shiftId)
 {
     return(await _shiftService.DeleteShift(shiftId));
 }
Exemple #6
0
        public async Task <IActionResult> DeleteShifts(string shiftID)
        {
            var response = await _shiftService.DeleteShift(shiftID);

            return(Ok(new ApiOkResponse(response)));
        }