public ContentResult addAuthenticatedUser(string UserID) { try { if (ModelState.IsValid) { HttpCookie CK = HttpContext.Request.Cookies.Get("LoginDetail"); if (CK != null) { SecurityUserModel entity = new SecurityUserModel(); entity.UserID = UserID; entity.SubsystemID = Int32.Parse(CK.Values["SubSystemID"].ToString()); _SecurityManager.Save(entity); return Content("success"); } else { return Content("fail"); } } else { throw new Exception(); } } catch (Exception ex) { var modal = new HandleErrorInfo(ex, "SecuritySetting", "index"); return Content("fail"); } }
public void Delete(SecurityUserModel entity) { objSecurityUser = new SecurityUserRepository(); tbl_Security_User objDelete = objSecurityUser.GetSingle(x => x.UserID.Equals(entity.UserID) && x.SubSystemID.Equals(entity.SubsystemID)); if (objSecurityUser.GetAll(x => x.UserID.Equals(entity.UserID) && x.SubSystemID.Equals(entity.SubsystemID)).Count() > 0) objSecurityUser.Delete(objDelete); }
public void Save(SecurityUserModel entity) { objSecurityUser = new SecurityUserRepository(); Mapper.CreateMap<SecurityUserModel, tbl_Security_User>(); tbl_Security_User objSave = new tbl_Security_User(); objSave = Mapper.Map(entity, objSave); if(objSecurityUser.GetAll(x=>x.UserID.Equals(entity.UserID) && x.SubSystemID.Equals(entity.SubsystemID)).Count()==0) objSecurityUser.Add(objSave); }