public ActionResult Create([Bind(Include = "Name")] CompanyViewModel company)
 {
     try
     {
         _companyAppService.Add(company);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View(company));
     }
 }
Exemplo n.º 2
0
        public ActionResult Create(CompanyViewModel companyViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    var company = Mapper.Map <CompanyViewModel, Company>(companyViewModel);
                    _companyApp.Add(company);

                    return(RedirectToAction("Index"));
                }
            }
            catch
            {
                return(View(companyViewModel));
            }
            return(View(companyViewModel));
        }