public IActionResult RejectByHumanResourceDept([FromRoute] int id)
        {
            var        username   = this.GetCurrentUserName();
            var        repo       = this.Storage.GetRepository <IQuickLeaveRepository>();
            QuickLeave quickLeave = repo.WithKey(id);

            if (quickLeave == null)
            {
                return(this.NotFound(new { success = false }));
            }
            quickLeave.HumanResourceDeptRejected(20, GetCurrentUserName());

            this.Storage.Save();
            return(Ok(new { success = true }));
        }
예제 #2
0
        public IActionResult RejectByHumanResourceDept([FromRoute] int id)
        {
            var        username   = this.GetCurrentUserName();
            var        repo       = this.Storage.GetRepository <IQuickLeaveRepository>();
            QuickLeave quickLeave = repo.WithKey(id);

            if (quickLeave == null)
            {
                return(this.NotFound(new { success = false }));
            }
            if (quickLeave.HasFeedbackByScrumMaster() || quickLeave.HasFeedbackByHumanResource())
            {
                this.ModelState.AddModelError("id", "Already have feedback by Srum Master or HR");
            }

            if (ModelState.IsValid)
            {
                quickLeave.HumanResourceDeptRejected(20, GetCurrentUserName());

                this.Storage.Save();
                return(Ok(new { success = true }));
            }
            return(BadRequest());
        }