Exemple #1
0
        public async Task <ActionResult> Create([Bind(Include = "CompanyName,CompanyEmail")] CompanyViewModel companyVM, bool AddAnotherCheckbox)
        {
            if (ModelState.IsValid)
            {
                Company companyDM = new Company();
                AutoMapper.Mapper.Map(companyVM, companyDM);
                await _companyServices.AddCompany(companyDM);

                TempData["msgSuccess"] = "Company Added";
                if (AddAnotherCheckbox == true)
                {
                    TempData["Checkbox"] = true;
                    return(RedirectToAction("Create"));
                }
                return(RedirectToAction("Index"));
            }
            TempData["msgFailed"] = "Add Company";
            return(View(companyVM));
        }