Esempio n. 1
0
 public Message Remove(Login_Log item)
 {
     try
     {
         _context.Entry(item).State = EntityState.Deleted;
         _context.SaveChanges();
         return(Message.Success);
     }
     catch (DbUpdateException)
     {
         return(Message.ErrorInRemove);
     }
     catch (Exception)
     {
         return(Message.ErrorInRemove);
     }
 }
Esempio n. 2
0
 public Message Update(Login_Log item)
 {
     try
     {
         _context.Login_Logs.Attach(item);
         _context.Entry(item).State = EntityState.Modified;
         _context.SaveChanges();
         return(Message.Success);
     }
     catch (DbUpdateException ex)
     {
         Microsoft.Data.Sqlite.SqliteException sqliteEX = ex.GetBaseException() as Microsoft.Data.Sqlite.SqliteException;
         int ErrorCode = sqliteEX.SqliteErrorCode;
         return(Message.unKnow);
     }
     catch (Exception)
     {
         return(Message.unKnow);
     }
 }
Esempio n. 3
0
 public Message Add(Login_Log item)
 {
     try
     {
         if (CheckUserID(item.UserID))
         {
             _context.Login_Logs.Add(item);
             _context.SaveChanges();
             return(Message.Success);
         }
         return(Message.UserNotFound);
     }
     catch (DbUpdateException ex)
     {
         Microsoft.Data.Sqlite.SqliteException sqliteEX = ex.GetBaseException() as Microsoft.Data.Sqlite.SqliteException;
         int ErrorCode = sqliteEX.SqliteErrorCode;
         return(Message.unKnow);
     }
     catch (Exception)
     {
         return(Message.unKnow);
     }
 }