Exemple #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var officeDto = new OfficeDto
            {
                ID = id
            };

            try
            {
                await officeServices.DeleteAsync(officeDto);
            }
            catch (System.Exception)
            {
                ModelState.AddModelError(string.Empty, "You cannot delete this office as there are employees assigned to it.");

                return(View("Manage"));
            }

            return(View("Manage"));
        }