public ActionResult Detail(Service service) { if (!ModelState.IsValid) { var model = new ServiceModel() { Service = service, ServiceTypes = EnumCollection.GetServiceTypeEnum() }; return(View(model)); } var result = ServiceTypeService.Save(service); if (result.HasError) { ViewBag.Error = result.Message; var model = new ServiceModel() { Service = service, ServiceTypes = EnumCollection.GetServiceTypeEnum() }; return(View(model)); } return(RedirectToAction("List")); }
public ActionResult PostServiceType([FromBody] ServiceTypeDto serviceTypeDto) { var response = _service.Add(serviceTypeDto); _service.Save(response); return(new OkObjectResult(response["Output"])); }
public void AddServiceType() { _service.Add(new ServiceTypeDto { Id = "3", Name = "name3" }); _service.Save(_dbContextMock); var result = _service.GetAll(); var count = result.Count(); Assert.AreEqual(3, count); }