/// <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); }
/// <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; } }
public IActionResult UpdatelogUser(TblLogUser logU) { int code = _iOrganizationRepository.UpdateLogUser(logU); if (code == 2) { return(StatusCode(200, "OK")); } else { return(StatusCode(400, "Err")); } }
/// <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); }
/// <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); }