예제 #1
0
        public ActionResult Create(LrpVM lrpUser)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    Lrp lrp = _mapper.Map <Lrp>(lrpUser);
                    _lrpUser.Insert(lrp);

                    User user = _mapper.Map <User>(lrpUser);
                    user.Name = lrpUser.fullName;
                    _user.Register(user, lrpUser.password);

                    ViewBag.Message = "Lrp User Created Successfully";
                    return(View());
                }
                else
                {
                    ModelState
                    .AddModelError(string.Empty, "Error");
                    return(View(lrpUser));
                }
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(string.Empty, ex.ToString());
                return(View());
            }
        }
예제 #2
0
        // GET: Lrp/Create
        public ActionResult Create()
        {
            LrpVM lrp = new LrpVM();

            return(View(lrp));
        }