public ActionResult AssignTillToUser(TillToUser model) { if (ModelState.IsValid) { try { TillToUser tillToUser = new TillToUser() { UserId = model.UserId, TillId = model.TillId }; tmRepo.Insert(tillToUser); return(RedirectToAction("Index")); } catch (Exception ex) { ErrorLogger.Log("Message= " + ex.Message + "\nInner Exception= " + ex.InnerException + "\n"); return(PartialView("Error")); } } //ViewBag.Msg = "Please enter correct data"; ViewBag.TillId = new SelectList(tmRepo.TillsWithoutTeller(), "ID", "AccountName", model.TillId); ViewBag.UserId = new SelectList(tmRepo.TellersWithoutTill(), "ID", "Username", model.UserId); return(View(model)); }
public ActionResult DeleteConfirmed(int id) { TillToUser tillToUser = db.TillToUsers.Find(id); db.TillToUsers.Remove(tillToUser); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Create([Bind(Include = "ID,UserId,GlAccountID")] TillToUser tillToUser) { if (ModelState.IsValid) { db.TillToUsers.Add(tillToUser); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.Users = new SelectList(tellerMgtLogic.ExtractTellersWithoutTill(), "Id", "UserName", tillToUser.UserId); ViewBag.GlAccountID = new SelectList(tellerMgtLogic.ExtractTillsWithoutTeller(), "ID", "AccountName", tillToUser.GlAccountID); return(View(tillToUser)); }
public ActionResult Edit([Bind(Include = "ID,UserId,GlAccountID")] TillToUser tillToUser) { if (ModelState.IsValid) { db.Entry(tillToUser).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } //ViewBag.Users = new SelectList(UserManager.Users, "Id", "UserName", tillToUser.UserId); ViewBag.GlAccountID = new SelectList(db.GlAccounts, "ID", "AccountName", tillToUser.GlAccountID); return(View(tillToUser)); }
// GET: TellerManagement/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TillToUser tillToUser = db.TillToUsers.Find(id); if (tillToUser == null) { return(HttpNotFound()); } //ViewBag.Users = new SelectList(UserManager.Users, "Id", "UserName", tillToUser.UserId); ViewBag.GlAccountID = new SelectList(db.GlAccounts, "ID", "AccountName", tillToUser.GlAccountID); return(View(tillToUser)); }
// GET: TellerManagement/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TillToUser tillToUser = db.TillToUsers.Find(id); if (tillToUser == null) { return(HttpNotFound()); } TillToUserViewModel model = new TillToUserViewModel { GLAccountName = tillToUser.GlAccount.AccountName, AccountBalance = tillToUser.GlAccount.AccountBalance.ToString(), Username = appdb.Users.Find(tillToUser.UserId).UserName }; return(View(model)); }