/// <summary> /// Se agrega un nuevo registro a los roles /// </summary> /// <param name="dbModel">Representa un objeto con la informaciĆ³n del rol</param> /// <returns>entero con la respuesta: 1. OK, 2. KO, 3. Ya existe</returns> public int RecordCreation(UserDbModel dbModel) { using (DesarrolloDocenteBDEntities db = new DesarrolloDocenteBDEntities()) { try { UserModelMapper mapper = new UserModelMapper(); SEC_USER record = mapper.MapperT2T1(dbModel); record.CREATE_DATE = dbModel.CurrentDate; record.CREATE_USER_ID = dbModel.UserInSessionId; db.SEC_USER.Add(record); db.SaveChanges(); return(1); } catch { return(2); } } }
public ActionResult Index(SEC_USER sec_user) { SEC_USER_LOGIN_Result user = db.SEC_USER_LOGIN(sec_user.USER_NAME, sec_user.USER_PWD, 1).FirstOrDefault(); //SEC_USER(sec_user.USER_NAME, sec_user.USER_PWD, null).FirstOrDefault(); if (user != null && user.USER_NO > 0) { string sess_id = Session.SessionID; string ip_addr = Request.ServerVariables["REMOTE_ADDR"]; // string device_id = CustomValidator.GetDeviceId(); SEC_USER_LOGONS_INSERT_Result LOGON_NO = db.SEC_USER_LOGONS_INSERT(user.USER_NO, ip_addr, null, null, null, null, sess_id, null, null).First(); Session["sess_sec_users"] = user; Session["sess_USER_NO"] = user.USER_NO; Session["sess_USER_NAME"] = user.USER_NAME; Session["sess_LOGON_NO"] = LOGON_NO; Response.Redirect("~/home"); } return View(); }