public void TestEditCarpentryServiceTypes() { string expectedName = "Edited name"; var service = new CarpentryServiceTypeService(carpentryWebsiteContext); CarpentryServiceType itemToAdd = new CarpentryServiceType { CarpentryServiceTypeId = 16, Name = "Name" }; service.AddCarpentryServiceType(itemToAdd); carpentryWebsiteContext.Entry(service.GetCarpentryServiceTypeDetails(16)).State = EntityState.Detached; service.UpdateCarpentryServiceType(new CarpentryServiceType { CarpentryServiceTypeId = 16, Name = "Edited name" }); CarpentryServiceType result = service.GetCarpentryServiceTypeDetails(16); Assert.Equal(expectedName, result.Name); }
public int Edit([FromBody] CarpentryServiceType carpentryServiceType) { return(carpentryServiceTypeService.UpdateCarpentryServiceType(carpentryServiceType)); }