Example #1
0
        public ActionResult Create(EmployeeDetailCreateViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                EmployeeDetail employeeDetail = model.ToEntity();
                this.Storage.GetRepository <IEmployeeDetailRepository>().Create(employeeDetail, this.GetCurrentUserName());
                this.Storage.Save();

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
        public IActionResult Post(EmployeeDetailCreateViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                EmployeeDetail employeeDetail = model.ToEntity();
                var            repo           = this.Storage.GetRepository <IEmployeeDetailRepository>();

                repo.Create(employeeDetail, GetCurrentUserName());
                this.Storage.Save();

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

            return(BadRequest(new { success = false }));
        }
Example #3
0
        public ActionResult Create()
        {
            var model = new EmployeeDetailCreateViewModel();

            return(View(model));
        }