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