예제 #1
0
        public ActionResult Create(QuickLeaveCreateViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                QuickLeave quickLeave = model.ToEntity();
                this.Storage.GetRepository <IQuickLeaveRepository>().Create(quickLeave, this.GetCurrentUserName());
                this.Storage.Save();

                return(RedirectToAction("Index"));
            }

            return(View(model));
        }
예제 #2
0
        public IActionResult Post(QuickLeaveCreateViewModel model)
        {
            if (this.ModelState.IsValid)
            {
                QuickLeave quickLeave = model.ToEntity();
                quickLeave.GetTotalTimeTaken();
                var repo = this.Storage.GetRepository <IQuickLeaveRepository>();

                repo.Create(quickLeave, GetCurrentUserName());
                this.Storage.Save();
                return(Ok(new { success = true }));
            }

            return(BadRequest(new { success = false }));
        }