public IActionResult Create(CaseStudyViewModel abs)
 {
     if (ModelState.IsValid)
     {
         CaseStudy model = _mapper.Map <CaseStudyViewModel, CaseStudy>(abs);
         model.CreatedBy = _admin.FullName;
         _casestudyRepository.CreateCaseStudy(model);
         return(RedirectToAction("index"));
     }
     return(View(abs));
 }
Ejemplo n.º 2
0
        public IActionResult Create(CaseStudyViewModel model)
        {
            ViewBag.Services = _serviceRepository.GetAllServices();
            ViewBag.Agents   = _caseStudyRepository.GetAllAgents();

            if (ModelState.IsValid)
            {
                var caseStudy = _mapper.Map <CaseStudyViewModel, CaseStudy>(model);

                caseStudy.AddedBy = _admin.Fullname;

                _caseStudyRepository.CreateCaseStudy(caseStudy);

                return(RedirectToAction("index"));
            }
            return(View(model));
        }