예제 #1
0
 // GET: Users/User
 public ActionResult Index()
 {
     UserProfile model = new UserProfile();
     ListboxHelper g = new ListboxHelper();
     model.getAllGender = g.GetAllGender();
     model.getAllUserTypes = g.GetAllUserTypes();
     return View(model);
 }
예제 #2
0
        public ActionResult Index(UserProfile model)
        {
            var client = new Connection().ConnectAmazonDynamoDB(new AmazonDBHelper().AmazonDBConnectionString());

            var table = Table.LoadTable(client, "user");
            var item = new Document();

            item["email"] = model.Email;
            item["password"] = model.Password;
            item["dob"] = model.DOB;
            item["firstname"] = model.FirstName;
            item["lastname"] = model.LastName;
            if (model.MiddleName != null && model.MiddleName != "")
                item["middlename"] = model.MiddleName;
            item["gender"] = model.GenderID;
            item["mobilephone"] = model.MobilePhone;
            item["usertype"] = model.UserTypeID;

            var licenses = new Document();
            if (model.LicenseExpireDate != null && model.LicenseExpireDate != "")
                licenses.Add("licenseexpiredate", model.LicenseExpireDate);
            if (model.LicenseIssueDate != null && model.LicenseIssueDate != "")
                licenses.Add("licenseissuedate", model.LicenseIssueDate);
            if (model.LicenseIssuePlace != null && model.LicenseIssuePlace != "")
                licenses.Add("licenseissueplace", model.LicenseIssuePlace);
            if (model.LicenseNumber != null && model.LicenseNumber != "")
                licenses.Add("licensenumber", model.LicenseNumber);
            item.Add("license", licenses);

            table.PutItem(item);

            ListboxHelper g = new ListboxHelper();
            model.getAllGender = g.GetAllGender();
            model.getAllUserTypes = g.GetAllUserTypes();
            return RedirectToAction("AddLocation", "User", new {Email = model.Email });
        }