Beispiel #1
0
 public ActionResult Register(RegisterViewModel model, HttpPostedFileBase image)
 {
     if (ModelState.IsValid && ValidateUserName(model.Username) && ValidateIdCard(model.IdCard) && ValidateAccountNumber(model.AccountNumber))
     {
         byte[] dbImage = null;
         if (image != null)
         {
             dbImage = FileUpload(image);
             Debug.WriteLine(image);
         }
         int query = db.PR_CreateCustomer(model.IdCard, model.Username, hashPassword(model.Password), model.Gender, model.BirthDate,
                                          model.Nationality, model.FirstName, model.MiddleName, model.LastName, model.SecondLastName, dbImage, model.AccountNumber);
         TempData["Success"] = "Success.";
         return(RedirectToAction("Login", "Account"));
     }
     ViewBag.Nationality = new SelectList(db.Country, "IdCountry", "Name", model.Nationality);
     return(View(model));
 }