예제 #1
0
        public ActionResult Registration(RegistrationModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var riders = new Riders()
            {
                DOB = model.DOB,

                Users = new Users()
                {
                    Name        = model.Name,
                    Email       = model.Email,
                    Password    = model.Password,
                    Mobile      = model.Mobile,
                    User_TypeID = (int)EnumCollection.UserTypeEnum.Rider,
                }
            };


            var result = RiderRepo.Save(riders);


            if (result.HasError)
            {
                ViewBag.Error = result.Message;
                return(View(model));
            }
            else
            {
                return(RedirectToAction("Login", "Account"));
            }
        }
예제 #2
0
        public ActionResult Profile(int id)
        {
            var result = RiderRepo.GetByID(id);

            return(View(result.Data ?? new Riders()
            {
                Users = new Users(), DOB = DateTime.Now
            }));
        }
예제 #3
0
        public ActionResult Delete(int id)
        {
            var result = RiderRepo.Delete(id);

            if (result.HasError)
            {
                TempData["Error"] = result.Message;
            }
            return(RedirectToAction("List"));
        }
예제 #4
0
        public ActionResult List(string key = "")
        {
            var result = RiderRepo.GetAll(key);

            if (TempData["Error"] != null)
            {
                ViewBag.Error = TempData["Error"];
            }
            return(View(result));
        }
예제 #5
0
        public ActionResult Profile(Riders riders)
        {
            if (!ModelState.IsValid)
            {
                return(View(riders));
            }

            var result = RiderRepo.Save(riders);

            if (result.HasError)
            {
                ViewBag.Error = result.Message;
                return(View(riders));
            }

            return(RedirectToAction("Index"));
        }