示例#1
0
文件: User.cs 项目: mehdin13/Airport
 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);
     }
 }
示例#2
0
文件: User.cs 项目: mehdin13/Airport
 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);
     }
 }