Exemple #1
0
        public async Task <IActionResult> Delete(DeleteServiceTypeViewModel model)
        {
            var success = await this.serviceTypesService.RemoveAsync(model.Id);

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

            return(this.RedirectToAction("All", "ServiceTypes"));
        }
Exemple #2
0
        public IActionResult Delete(int id)
        {
            ServiceTypeServiceModel serviceType = this.serviceTypesService.GetById(id);

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

            var model = new DeleteServiceTypeViewModel
            {
                Id                = serviceType.Id,
                Name              = serviceType.Name,
                Description       = serviceType.Description,
                IsShownInMainMenu = serviceType.IsShownInMainMenu == true ? "Да" : "Не",
                //TODO: Add services table on delete view
            };

            return(this.View(model));
        }