Exemple #1
0
        public IActionResult Post(CreateViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                Employee employee = model.ToEntity(this.GetCurrentUserName());
                this.Storage.GetRepository <IEmployeeRepository>().Create(employee);
                this.Storage.Save();

                return(Ok(new { success = true }));
            }

            return(BadRequest(new { success = false }));
        }
Exemple #2
0
        public ActionResult Create(CreateViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                Employee employee = model.ToEntity();
                this.Storage.GetRepository <IEmployeeRepository>().Create(employee, this.GetCurrentUserName());
                this.Storage.Save();

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }