Пример #1
0
        public ActionResult UserRegistrationBlank(RegForm obj)
        {
            if (ModelState.IsValid)
            {

                UserProfile profile = new UserProfile();
                profile.LastName = obj.LastName;
                profile.FirstName = obj.FirstName;
                profile.ParentName = obj.ParentName;
                profile.DateOfBirth = obj.BirthDate;

                profile.DegreeID = obj.SelectedDegreeID;
                profile.LoginID = obj.LoginID;

                byte[] imgBuffer = null;
                if (obj.ImgFile != null)
                {
                    imgBuffer = new byte[obj.ImgFile.ContentLength];
                    using (Stream memStrm = obj.ImgFile.InputStream)
                    {
                        memStrm.Read(imgBuffer, 0, imgBuffer.Length);
                    }
                }

                profile.Photo = imgBuffer;

                if (_dbServices.saveModeltoDB(typeof(UserProfile), profile))

                    return RedirectToAction("UiResultUpdatable", "UiProfile", new { id = profile.UserProfileID });
                else
                    return RedirectToAction("Index", "Home");
            }

            return View(obj);
        }
Пример #2
0
        public ActionResult UserRegistrationBlank()
        {
            Guid newUserId = Guid.Empty;
            if(Session["NewUserLoginID"]!=null)
               newUserId = (Guid)Session["NewUserLoginID"];

            RegForm _blank = new RegForm();
            _blank.LoginID = newUserId;
            return View(_blank);
        }
Пример #3
0
        public ActionResult UiResultUpdatable()
        {
            Guid newUserId = Guid.Parse("13474517-c22f-4829-8a99-8df51864c313");
            //Guid newUserId = id;//13474517-c22f-4829-8a99-8df51864c313

            UserProfile query = (from c in _dbServices.DataBase.UserProfile
                             .Include("MilitaryDegree").Include("Contacts")
                         where c.UserProfileID.Equals(newUserId)
                         select c).FirstOrDefault();

            RegForm regForm = new RegForm();

            regForm.CurrentAccounID = newUserId;
            ViewBag.Image = File(query.Photo, "image/jpg");

            regForm.createBinding(query);
            return View(regForm);
        }