public async Task <IActionResult> CreateMultipleServiceCategories([FromBody] SaveMultipleServiceCategories resource) { try { _repository.DeleteServiceServiceTypesByServiceId(resource.ServiceId); var serviceCategories = resource.ServiceCategoryId; var lstCategories = new List <ServiceServiceTypes>(); foreach (var s in serviceCategories) { var input = new ServiceServiceTypes { ServiceId = resource.ServiceId, ServiceCategoryId = s, ServiceTypeId = resource.ServiceTypeId }; _repository.AddServiceCategory(input); lstCategories.Add(input); } return(Ok(lstCategories)); } catch (Exception x) { return(BadRequest(x.Message)); } }
public void AddServiceServiceType(ServiceServiceTypes serviceServiceTypes) { _context.Add(serviceServiceTypes); }
public void DeleteServiceServiceType(ServiceServiceTypes serviceServiceTypes) { _context.Remove(serviceServiceTypes); }
public void AddServiceCategory(ServiceServiceTypes serviceCategory) { _context.Add(serviceCategory); _context.SaveChanges(); }