Ejemplo n.º 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));
            }
        }
Ejemplo n.º 2
0
 public void AddServiceServiceType(ServiceServiceTypes serviceServiceTypes)
 {
     _context.Add(serviceServiceTypes);
 }
Ejemplo n.º 3
0
 public void DeleteServiceServiceType(ServiceServiceTypes serviceServiceTypes)
 {
     _context.Remove(serviceServiceTypes);
 }
Ejemplo n.º 4
0
 public void AddServiceCategory(ServiceServiceTypes serviceCategory)
 {
     _context.Add(serviceCategory);
     _context.SaveChanges();
 }