Esempio n. 1
0
 public IHttpActionResult Put_UpdateCheck([FromBody] m_edit_check request, int Id)
 {
     try
     {
         var res = _Check.UpdateCheck(request, Id);
         return(Json(res));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }
Esempio n. 2
0
 public Check UpdateCheck(m_edit_check input, int id)
 {
     if (db.Checks.Count(c => c.Id == id) == 1)
     {
         var update = db.Checks.FirstOrDefault(c => c.Id == id);
         update.number_lower = input.number_lower;
         update.number_three = input.number_three;
         update.number_upper = input.number_upper;
         var res = db.SaveChanges();
         if (res > 0)
         {
             return(update);
         }
         throw new Exception("failed save to database");
     }
     throw new Exception("don't have your check lottery");
 }