private void btnSave_Click(object sender, EventArgs e)
        {
            Car         car         = GetEditedCar();
            CarBusiness carBusiness = new CarBusiness();

            carBusiness.Update(car);
            PopulateDataGridViewDefault();
            ResetSelect();
            ToggleSaveUpdate();
            ClearTextBoxes();
        }
示例#2
0
 public bool Update(Car car)
 {
     try
     {
         using (var u = new CarBusiness())
         {
             return(u.Update(car));
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(false);
     }
 }
示例#3
0
 public IHttpActionResult Put([FromBody] Car car)
 {
     try
     {
         using (var c = new CarBusiness())
         {
             if (c.Update(car))
             {
                 return(Ok());
             }
             return(NotFound());
         }
     }
     catch (Exception ex)
     {
         return(BadRequest($"{ex}"));
     }
 }