Ejemplo n.º 1
0
        public ActionResult Create(FormCollection form, CreateDealerInput input, HttpPostedFileBase tin_file, HttpPostedFileBase bl_file)
        {
            if (ModelState.IsValid)
            {
                if (tin_file != null && bl_file != null)
                {
                }

                var user = _userAppService.GetLoggedInUser();
                input.StationId = user.StationId;    //get user logged in station
                int Id = _dealerAppService.CreateDealer(input);

                //update selected candidate if exists

                if (form.AllKeys.Contains("CandidateId") && !string.IsNullOrEmpty(form.Get("CandidateId").ToString()))
                {
                    var candidate = _candidateAppService.GetCandidate(Convert.ToInt32(form.Get("CandidateId")));
                    _candidateAppService.RegisterCandidate(candidate);
                }

                return(RedirectToAction("Create", "DealerActivities", new { id = Id }));
            }
            else
            {
                var stations = _stationAppService.GetStations().Select(c => new SelectListItem {
                    Value = c.Id.ToString(), Text = c.Name
                });
                ViewBag.StationId = stations;
                return(View());
            }
        }
Ejemplo n.º 2
0
 // GET: Candidates/Register/5
 public ActionResult Register(int id)
 {
     ViewBag.Candidate = _candidateAppService.GetCandidate(id);
     return(View());
 }