Esempio n. 1
0
 public IHttpActionResult Get(int id)
 {
     try
     {
         Bussiness u = BussinessDB.GetBussinessByID(id);
         if (u != null)
         {
             return(Ok(u));
         }
         return(Content(HttpStatusCode.NotFound, $"bussiness witn id {id} was not found!!!"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 2
0
 public IHttpActionResult Put([FromBody] Bussiness bussiness2Update)
 {
     try
     {
         Bussiness u = BussinessDB.GetBussinessByID(bussiness2Update.Bussiness_Id);
         if (u != null)
         {
             int res = BussinessDB.UpdateBussiness(bussiness2Update);
             if (res == 1)
             {
                 return(Ok($"bussiness with id = {bussiness2Update.Bussiness_Id} updated"));
             }
             return(Content(HttpStatusCode.NotModified, $"bussiness with id = {bussiness2Update.Bussiness_Id} exsits but could not be modified!!!"));
         }
         return(Content(HttpStatusCode.NotFound, $"bussiness with id = {bussiness2Update.Bussiness_Id} was not found to update!!!"));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }