コード例 #1
0
        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));
            }
        }
コード例 #2
0
 public void AddServiceServiceType(ServiceServiceTypes serviceServiceTypes)
 {
     _context.Add(serviceServiceTypes);
 }
コード例 #3
0
 public void DeleteServiceServiceType(ServiceServiceTypes serviceServiceTypes)
 {
     _context.Remove(serviceServiceTypes);
 }
コード例 #4
0
 public void AddServiceCategory(ServiceServiceTypes serviceCategory)
 {
     _context.Add(serviceCategory);
     _context.SaveChanges();
 }