示例#1
0
        /// <summary>
        /// AddlogUser
        /// </summary>
        /// <param name="logUser"></param>
        /// <returns></returns>
        public int AddlogUser(TblLogUser logUser)
        {
            int        abc;
            TblLogUser LogU = db.TblLogUser.Where(v => v.Id == logUser.Id).FirstOrDefault();

            if (LogU != null)
            {
                abc = 1;
            }
            else
            {
                TblLogUser addLog = new TblLogUser();
                addLog.ActionName       = logUser.ActionName;
                addLog.ActionType       = logUser.ActionType;
                addLog.OrganizationCode = logUser.OrganizationCode;
                addLog.ActionDate       = logUser.ActionDate;
                addLog.Username         = logUser.Username;
                db.TblLogUser.Add(addLog);
                db.SaveChanges();

                abc = 2;
            }

            return(abc);
        }
示例#2
0
 /// <summary>
 /// Fuction add log
 /// CreatedBy: HaiHM
 /// CreatedDate: 6/5/2019
 /// </summary>
 /// <param name="log">log</param>
 public void AddLog(TblLogUser log)
 {
     try
     {
         db.TblLogUser.Add(log);
         db.SaveChanges();
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         throw ex;
     }
 }
示例#3
0
        public IActionResult UpdatelogUser(TblLogUser logU)
        {
            int code = _iOrganizationRepository.UpdateLogUser(logU);

            if (code == 2)
            {
                return(StatusCode(200, "OK"));
            }
            else
            {
                return(StatusCode(400, "Err"));
            }
        }
示例#4
0
        /// <summary>
        /// DeleteLogUser
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>

        public int DeleteLogUser(int id)
        {
            int        result;
            TblLogUser LogUChk = db.TblLogUser.Where(v => v.Id == id).FirstOrDefault();

            if (LogUChk != null)
            {
                db.TblLogUser.Remove(LogUChk);
                db.SaveChanges();
                result = 2;
            }
            else
            {
                result = 1;
            }
            return(result);
        }
示例#5
0
        /// <summary>
        /// UpdateLogUser
        /// </summary>
        /// <param name="logUser"></param>
        /// <returns></returns>
        public int UpdateLogUser(TblLogUser logUser)
        {
            int        result;
            TblLogUser LogUChk = db.TblLogUser.Where(v => v.Id == logUser.Id).FirstOrDefault();

            if (LogUChk != null)
            {
                LogUChk.ActionName       = logUser.ActionName;
                LogUChk.ActionDate       = logUser.ActionDate;
                LogUChk.Username         = logUser.Username;
                LogUChk.ActionType       = logUser.ActionType;
                LogUChk.OrganizationCode = logUser.OrganizationCode;
                db.Entry(LogUChk).State  = EntityState.Modified;
                db.SaveChanges();
                result = 2;
            }
            else
            {
                result = 1;
            }
            return(result);
        }