コード例 #1
0
 public ActionResult Edit([Bind(Include = "UserId,UserName,Password,IsActive")] UserProfile userProfile)
 {
     if (ModelState.IsValid)
     {
         db.Entry(userProfile).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(userProfile));
 }
コード例 #2
0
        public ActionResult Approve(int id)
        {
            int      ID   = id;
            tblSkill idea = entity.tblSkills.FirstOrDefault(g => g.skId == id);

            idea.skStatus            = "Approved";
            entity.Entry(idea).State = System.Data.Entity.EntityState.Modified;
            entity.SaveChanges();
            return(RedirectToAction("ConfirmEmail", new { id = ID }));
        }
コード例 #3
0
 public ActionResult Edit([Bind(Include = "idColaborador,Nome,Email,CPF,Senha,Oficio,DataNascimento,Sexo,Telefone,Disponibilidade")] Colaborador colaborador)
 {
     if (ModelState.IsValid)
     {
         db.Entry(colaborador).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(colaborador));
 }
コード例 #4
0
 public ActionResult Edit([Bind(Include = "usuarioId,Nombre,CorreoElectronico,nombreus,pass")] Usuario usuario)
 {
     if (ModelState.IsValid)
     {
         db.Entry(usuario).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(usuario));
 }
コード例 #5
0
 public ActionResult Edit([Bind(Include = "UserID,Username,Password")] User user)
 {
     if (ModelState.IsValid)
     {
         db.Entry(user).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(user));
 }
コード例 #6
0
 public ActionResult Edit([Bind(Include = "skId,skName,skExperience,skPrevProjects,skCurrentProject,skDomain,skUsername")] tblSkill tblSkill)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tblSkill).State = EntityState.Modified;
         db.SaveChanges();
         string un = loggedinUser;
         return(RedirectToAction("Dashboard_Employee", new { uname = loggedinUser }));
     }
     return(View(tblSkill));
 }
コード例 #7
0
        public ActionResult Transfer([Bind(Include = "AccountNumber,TransferFrom,TransferTo,TransferAmount,TransferDate,CurrentBalance,Funds,CustomerName")] TransactionDetail transactionDetail)
        {
            if (Session["UserName"] != null && Session["UserRole"].ToString().Contains("Customer"))
            {
                if (ModelState.IsValid)
                {
                    transactionDetail.TransferDate  = DateTime.Now;
                    transactionDetail.AccountNumber = Convert.ToInt32(Session["AccountNumber"]);
                    transactionDetail.TransferFrom  = Convert.ToInt32(Session["AccountNumber"]);
                    transactionDetail.CustomerName  = Convert.ToString(Session["CustomerName"]);
                    db2.TransactionDetails.Add(transactionDetail);
                    db2.SaveChanges();

                    //Receivers Balance Increases
                    BanksCustomer banksCustomer = new BanksCustomer();
                    banksCustomer = db2.BanksCustomers.Where(u => u.AccountNumber == transactionDetail.TransferTo).FirstOrDefault();
                    LoginDetails updateBalanceReveiver = db.LoginDetails.Where(u => u.AccountNumber1 == transactionDetail.TransferTo).FirstOrDefault();
                    updateBalanceReveiver.CurrentBalance += transactionDetail.TransferAmount;
                    db.Entry(updateBalanceReveiver).Property("CurrentBalance").IsModified = true;
                    db.SaveChanges();

                    //Senders Balance Decreases
                    banksCustomer = db2.BanksCustomers.Where(u => u.AccountNumber == transactionDetail.TransferFrom).FirstOrDefault();
                    LoginDetails updateBalanceSender = db.LoginDetails.Where(u => u.AccountNumber1 == transactionDetail.TransferFrom).FirstOrDefault();
                    updateBalanceSender.CurrentBalance -= transactionDetail.TransferAmount;
                    db.Entry(updateBalanceSender).Property("CurrentBalance").IsModified = true;
                    db.SaveChanges();

                    return(RedirectToAction("Index"));
                }

                ViewBag.ReceiversAccountNumber = new SelectList(db2.BanksCustomers.Where(u => u.UserRole.ToString().Contains("Customer")), "AccountNumber", "AccountNumber", transactionDetail.AccountNumber);
                return(View(transactionDetail));
            }

            Response.Write("<script>alert('Session logged out. Sign in again');</script>");
            FormsAuthentication.SignOut();
            Session.Clear();
            return(RedirectToAction("SignIn", "Auth"));
        }
コード例 #8
0
        public ActionResult AddFund(Fund fund)
        {
            if (ModelState.IsValid)
            {
                //Customers Fund Increases into BanksCustomer Table
                BanksCustomer banksCustomer = db.BanksCustomers.Where(u => u.AccountNumber == fund.AccountNumber).FirstOrDefault();
                LoginDetails  updateFund    = db2.LoginDetails.Where(u => u.AccountNumber1 == fund.AccountNumber).FirstOrDefault();
                updateFund.Fund = banksCustomer.Fund + fund.Fund1;
                db2.Entry(updateFund).Property("Fund").IsModified = true;
                db2.SaveChanges();

                //Save Funds History into Fund Table
                db.Funds.Add(fund);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View());
        }