示例#1
0
        public IActionResult Promoters(int companyId)
        {
            ViewBag.CompanyId = companyId;

            AddPromotersVM addPromotersVM = new AddPromotersVM();

            addPromotersVM.CompanyId = companyId;
            return(View(addPromotersVM));
        }
示例#2
0
        public IActionResult CreatePromoter(AddPromotersVM addPromotersVM)
        {
            if (!ModelState.IsValid)
            {
                ShowToaster("Please fill required fields", ToasterLevel.Danger);
                return(RedirectToAction("Promoters", "Company", new { companyId = addPromotersVM.CompanyId }));
            }
            var             config = new MapperConfiguration(cfg => cfg.CreateMap <AddPromotersVM, AddPromotersDTO>());
            var             mapper = new Mapper(config);
            AddPromotersDTO dto    = mapper.DefaultContext.Mapper.Map <AddPromotersDTO>(addPromotersVM);

            _userService.CreateAndUpdatePromoter(dto);
            ShowToaster("Promoter created successfully", ToasterLevel.Success);

            return(RedirectToAction("Promoters", "Company", new { companyId = dto.CompanyId }));
        }