Ejemplo n.º 1
0
 public int Insert(AirPortModel.Models.Flight obj)
 {
     try
     {
         obj.DateCreate = DateTime.Now;
         obj.LastUpdate = DateTime.Now;
         obj.IsDelete   = false;
         _db.flights.Add(obj);
         _db.SaveChanges();
         return(obj.Id);
     }
     catch (Exception)
     {
         return(0);
     }
 }
Ejemplo n.º 2
0
 public ProgressStatus Update(AirPortModel.Models.Flight obj)
 {
     try
     {
         obj.LastUpdate = DateTime.Now.Date;
         _db.flights.Update(obj);
         _db.SaveChanges();
         var result = new ProgressStatus {
             Number = 1, Title = "Update Successful", Message = "Flight Has been Update"
         };
         return(result);
     }
     catch (Exception ex)
     {
         var result = new ProgressStatus {
             Number = 0, Title = "Update Error", Message = ex.Message
         };
         return(result);
     }
 }