public IActionResult Edit(int id) { OperatingLocationServiceModel operatingLocation = this.operatingLocationsService.GetById(id); if (operatingLocation.Town == null || operatingLocation.Address == null) { return(this.BadRequest()); } var model = new OperatingLocationInputModel { Id = operatingLocation.Id, Town = operatingLocation.Town, Address = operatingLocation.Address, Description = operatingLocation.Description, ImageUrl = operatingLocation.ImageUrl, DepartmentIds = operatingLocation.DepartmentIds, Departments = this.departmentsService.GetAll().Select(x => new DepartmentsDropdownViewModel { Id = x.Id, Name = x.Name, Email = x.Email, Phones = x.Phones.Select(x => new PhonesDropdownViewModel { Id = x.Id, PhoneNumber = x.PhoneNumber, }) }), }; return(this.View(model)); }
public IActionResult Delete(int id) { OperatingLocationServiceModel operatingLocation = this.operatingLocationsService.GetById(id); if (operatingLocation.Town == null || operatingLocation.Address == null) { return(this.BadRequest()); } var model = new DeleteOperatingLocationViewModel { Id = operatingLocation.Id, Town = operatingLocation.Town, Address = operatingLocation.Address, //TODO: Add departments, employees and service tables on delete view }; return(this.View(model)); }