Beispiel #1
0
 public User Create(User user)
 {
     user.CreateTime       = DateTime.Now;
     user.LastModifiedTime = DateTime.Now;
     context.Users.Add(user);
     context.SaveChanges();
     return(user);
 }
 public Transfer Create(Transfer transfer)
 {
     try {
         userCore.UpdatePoints(transfer.UserId, transfer.Amount, false);
         transfer.CreateTime = DateTime.Now;
         context.Transfers.Add(transfer);
         context.SaveChanges();
         return(transfer);
     } catch (DbUpdateConcurrencyException _) {
         return(Create(transfer));
     }
 }