Esempio n. 1
0
        public IActionResult ApproveByScrumMaster(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 }));
            }

            // TODO : find correct Employee ID from Username
            if (quickLeave.HasFeedbackByScrumMaster() || quickLeave.HasFeedbackByHumanResource())
            {
                this.ModelState.AddModelError("id", "Already have feedback by Scrum Master or HR");
            }

            if (this.ModelState.IsValid)
            {
                // TODO : find correct Employee ID from Username
                quickLeave.ScrumMasterApproved(10, GetCurrentUserName());

                this.Storage.Save();

                return(Ok(new { success = true }));
            }
            else
            {
                return(BadRequest());
            }
        }
        public IActionResult ApproveByScrumMaster(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 }));
            }
            // TODO : find correct Employee ID from Username
            quickLeave.ScrumMasterApproved(10, GetCurrentUserName());

            this.Storage.Save();

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