public ReturnObjValueBackEnd DeleteUser(List <string> lstID) { retObjValueBackEnd = new ReturnObjValueBackEnd(); try { var ctx = new BankingContext(); MSTUSER userModel = new MSTUSER(); for (int i = 0; i < lstID.Count; i++) { var query = from user in ctx.MstUser where user.USERID.Equals(lstID[i]) select user; if (query.ToList().Count > 0) { userModel = query.ToList()[0]; } userModel.DELETE_YMD = DateTime.Now; UpdateUser(userModel); } retObjValueBackEnd.Success = true; return(retObjValueBackEnd); } catch (Exception ex) { retObjValueBackEnd.Success = false; retObjValueBackEnd.Message = ex.ToString(); return(retObjValueBackEnd); throw ex; } }
public void DeleteUser(List <string> lstID) { try { var ctx = new BankingContext(); MSTUSER userModel = new MSTUSER(); for (int i = 0; i < lstID.Count; i++) { var query = from user in ctx.MstUser where user.USERID.Equals(lstID[i]) select user; if (query.ToList().Count > 0) { userModel = query.ToList()[0]; } userModel.DELETE_YMD = DateTime.Now; UpdateUser(userModel); } } catch (Exception ex) { throw ex; } }
public void UpdateUser(MSTUSER objUpdate) { try { var ctx = new BankingContext(); ctx.Entry(objUpdate).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); } catch (Exception ex) { throw ex; } }
public void InsertUser(MSTUSER objInsert) { try { var ctx = new BankingContext(); ctx.MstUser.Add(objInsert); ctx.SaveChanges(); } catch (Exception ex) { throw ex; } }
public ReturnObjValueBackEnd InsertUser(MSTUSER objInsert) { retObjValueBackEnd = new ReturnObjValueBackEnd(); try { var ctx = new BankingContext(); ctx.MstUser.Add(objInsert); ctx.SaveChanges(); retObjValueBackEnd.Success = true; return(retObjValueBackEnd); } catch (Exception ex) { retObjValueBackEnd.Success = false; retObjValueBackEnd.Message = ex.ToString(); return(retObjValueBackEnd); throw ex; } }
public ReturnObjValueBackEnd UpdateUser(MSTUSER objUpdate) { retObjValueBackEnd = new ReturnObjValueBackEnd(); try { var ctx = new BankingContext(); ctx.Entry(objUpdate).State = System.Data.Entity.EntityState.Modified; ctx.SaveChanges(); retObjValueBackEnd.Success = true; return(retObjValueBackEnd); } catch (Exception ex) { retObjValueBackEnd.Success = false; retObjValueBackEnd.Message = ex.ToString(); return(retObjValueBackEnd); throw ex; } }
public ActionResult Index(MSTUSER mu) { if (ModelState.IsValid) { var logindata = db.MSTUSERS.Where(m => m.USERNAME == mu.USERNAME && m.PASSWORD == mu.PASSWORD).FirstOrDefault(); if (logindata == null) { ViewBag.errormsg = "Invalid Username or Paasword"; return(View()); } else { Session["loginuserrid"] = logindata.RID; Session["loginusername"] = logindata.USERNAME; return(RedirectToAction("Index", "Home")); } } else { return(View()); } }