Esempio n. 1
0
        public async Task <IActionResult> Delete(DeleteDepartmentViewModel model)
        {
            var success = await this.departmentsService.RemoveAsync(model.Id);

            if (!success)
            {
                return(this.RedirectToAction("Error", "Home")); // TODO: redirect
            }

            return(this.RedirectToAction("All", "Departments"));
        }
Esempio n. 2
0
        public IActionResult Delete(int id)
        {
            DepartmentServiceModel department = this.departmentsService.GetById(id);

            if (department.Name == null)
            {
                return(this.BadRequest());
            }

            var model = new DeleteDepartmentViewModel
            {
                Id          = department.Id,
                Name        = department.Name,
                Email       = department.Email,
                Description = department.Description,
                //TODO: add phones table on delete view
            };

            return(this.View(model));
        }