コード例 #1
0
        public JsonResult AddAccountDetails(FormCollection form)
        {
            var account = new AccountDto
            {
                Street            = form["street"],
                BuildingNumber    = form["buildingnumber"],
                FlatNumber        = form["flatnumber"],
                ZipCode           = form["zipcode"],
                City              = form["city"],
                CountryId         = Convert.ToInt32(form["Countries"]),
                PhoneNumber       = form["phonenumber"],
                RoleId            = Convert.ToInt32(form["RoleId"]),
                UserId            = form["UserId"],
                DateOfBirth       = Convert.ToDateTime(form["dateofbirth"]),
                WardId            = Convert.ToInt32(form["Wards"]),
                Degree            = form["degree"],
                Pwz               = form["pwz"],
                SpecialtyId       = Convert.ToInt32(form["Specialties"]),
                DegreeOfSpecialty = Convert.ToInt32(form["degreeofspecialty"])
            };

            var result = _repository.AddAccountDetails(account);

            return(Json(new
            {
                type = result ? "OK" : "Error",
                message = result ? "Poprawnie uzupełniono dane" : "Wystąpił błąd!"
            }));
        }