Beispiel #1
0
        public async Task <IActionResult> Delete(OfficeViewModel officeVM)
        {
            await _officeRepo.DeleteOffice(officeVM.Office);

            TempData["message"]     = "Your data has been deleted successfully.";
            TempData["toasterType"] = ToasterType.success;

            //return RedirectToAction(nameof(Index));

            return(Redirect(officeVM.ReturnUrl));
        }
Beispiel #2
0
        public IActionResult DeleteOffice(int id)
        {
            var office = _officeRepository.FindOfficeById(id);

            if (office == null)
            {
                return(NotFound());
            }

            _officeRepository.DeleteOffice(office);
            return(Ok());
        }
        public async Task <ActionResult> DeleteOffice(int id)
        {
            var officeFromRepo = await _officeRepository.GetOfficeAsync(id);

            if (officeFromRepo == null)
            {
                return(NotFound());
            }

            _officeRepository.DeleteOffice(officeFromRepo);
            await _officeRepository.SaveAsync();

            return(NoContent());
        }
        public async Task <ApiResponse> DeleteOffice(long id)
        {
            var officeToDelete = await _officeRepo.FindOfficeById(id);

            if (officeToDelete == null)
            {
                return(new ApiResponse(404));
            }

            if (!await _officeRepo.DeleteOffice(officeToDelete))
            {
                return(new ApiResponse(500));
            }

            return(new ApiOkResponse(true));
        }
Beispiel #5
0
        public IActionResult DeleteOffice(int id)
        {
            if (id == 0)
            {
                return(BadRequest());
            }

            var officeToDelete = _officeRepository.GetOfficeById(id);

            if (officeToDelete == null)
            {
                return(NotFound());
            }

            _officeRepository.DeleteOffice(id);

            return(NoContent());//success
        }
 public IActionResult DeleteOffice(int id)
 {
     _officeRepo.DeleteOffice(id);
     return(Ok("Office Deleted"));
 }
Beispiel #7
0
 public IActionResult DeleteOffice(int id)
 {
     _officeRepo.DeleteOffice(id);
     return(RedirectToRoute("Offices"));
 }