Пример #1
0
 private void newBtns1_btnDelete_Event(object sender, EventArgs e)
 {
     if (MessageBox.Show(Properties.Resources.msgDelete, "삭제 확인", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         ShiftService service = new ShiftService();
         service.DeleteShift(vo.shift_id);
         ShiftList();
     }
 }
Пример #2
0
        public async Task <IActionResult> Delete(int shiftId)
        {
            // Get the shift
            Shift shift = await _shiftService.GetShift(shiftId);

            if (shift == null)
            {
                return(BadRequest());
            }

            // Check that the user has management access
            string userId = _userManager.GetUserId(User);
            Member member = await _memberService.GetMember(shift.Location.GroupId, userId);

            if (member == null || !member.Approved || !member.CanManageShifts)
            {
                return(BadRequest());
            }

            await _shiftService.DeleteShift(shift);

            return(Ok());
        }