public void TestEditCarpentryServices()
        {
            string           expectedDescription = "Different desc";
            var              service             = new CarpentryServiceService(carpentryWebsiteContext);
            CarpentryService itemToAdd           = new CarpentryService {
                CarpentryServiceId = 14, Name = "Name", Price = 5000, Description = "Different desc", CarpentryServiceTypeId = 500
            };

            service.AddCarpentryService(itemToAdd);
            carpentryWebsiteContext.Entry(service.GetCarpentryServiceDetails(14)).State = EntityState.Detached;

            service.UpdateCarpentryService(new CarpentryService {
                CarpentryServiceId = 14, Name = "Name", Price = 5000, Description = "Different desc", CarpentryServiceTypeId = 501
            });
            CarpentryService result = service.GetCarpentryServiceDetails(14);

            Assert.Equal(expectedDescription, result.Description);
        }
Esempio n. 2
0
 public int Edit([FromBody] CarpentryService carpentryService)
 {
     return(carpentryServiceService.UpdateCarpentryService(carpentryService));
 }