public ActionResult Create([Bind(Include = "Id,CustomerId,BankAccountNumber,BankBranchName,BankAddress,AvailableBalance")] Employee employee)
        {
            if (ModelState.IsValid)
            {
                db.Employees.Add(employee);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(employee));
        }
 public ActionResult AdminRegister([Bind(Include = "Id,UserId,FirstName,LastName,DateOfBirth,Gender,PhoneNumber,Address,City,State,ZipCode,Email,UserName,Password,ConfirmPassword,SecretQuestions,Answer,RegisterDate")] UserLogin userLogin, string UserRole1)
 {
     if (ModelState.IsValid)
     {
         if (UserRole1 == "Admin")
         {
             db.UserLogins.Add(userLogin);
             db.SaveChanges();
             return(RedirectToAction("AdminLogin"));
         }
     }
     else
     {
         ViewBag.ErrorMessage = "pass the correct user role";
     }
     return(View());
 }
 public ActionResult CustomerRegister([Bind(Include = "Id,UserId,FirstName,LastName,DateOfBirth,Gender,PhoneNumber,Address,City,State,ZipCode,UserName,Password,ConfirmPassword,SecretQuestions,Answer,RegisterDate")] CustomerRegister customerRegister, string UserRole)
 {
     if (ModelState.IsValid)
     {
         if (UserRole == "Customer")
         {
             db.CustomerRegisters.Add(customerRegister);
             db.SaveChanges();
             return(RedirectToAction("CustomerLogin"));
         }
     }
     else
     {
         ModelState.AddModelError(" ", "pass the correct user role");
     }
     return(View());
 }
        public ActionResult Create([Bind(Include = "Id,CustomerId,FirstName,LastName,PhoneNumber,Email,BankAccountNo,BankBranch,ChargeBackAmount,Reason,DateOfTransaction")] ComplaintRegister complaintregister, int customerid)
        {
            if (ModelState.IsValid)
            {
                var user = db.CustomerRegisters.Where(x => x.UserId == customerid).FirstOrDefault();
                if (user != null)
                {
                    var user1 = db.Employees.Where(x => x.CustomerId == customerid).FirstOrDefault();
                    if (user1 != null)
                    {
                        db.ComplaintRegisters.Add(complaintregister);
                        db.SaveChanges();
                        TempData["Message"] = "Complaint Lodged Successfully ";
                        //return RedirectToAction("Index");
                    }
                    else
                    {
                        return(View(complaintregister));
                    }
                }
            }

            return(View(complaintregister));
        }
Ejemplo n.º 5
0
 public void Save(UserLoginDbContext userContext)
 {
     userContext.SaveChanges();
 }