コード例 #1
0
        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));
        }
コード例 #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            TillToUser tillToUser = db.TillToUsers.Find(id);

            db.TillToUsers.Remove(tillToUser);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #3
0
 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));
 }
コード例 #4
0
 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));
 }
コード例 #5
0
        // 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));
        }
コード例 #6
0
        // 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));
        }