/// <summary>
 /// https://localhost:44370/api/ServiceImage?serviceId=1
 /// </summary>
 /// <returns></returns>
 public IHttpActionResult Get(int serviceId)
 {
     try
     {
         return(Ok(ServiceImageModel.GetAllServiceImages(serviceId, db)));
     }
     catch (Exception ex)
     {
         return(Content(HttpStatusCode.BadRequest, ex));
     }
 }
 public void UpsertServiceImage(ServiceImageModel input)
 {
     try
     {
         if (input.Id == 0)
         {
             _context.ServiceImages.Add(input);
         }
         else
         {
             _context.Entry(input).State = EntityState.Modified;
         }
         _context.SaveChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 3
0
 public ActionResult AddNewServiceImage(ServiceImageModel model)
 {
     _serviceImages.UpsertServiceImage(model);
     return(RedirectToAction("MyServiceImages", new { ServiceId = model.ServiceId }));
 }