예제 #1
0
        public bool UpdateLeave(int leaveId, bool isApproved)
        {
            var   leaves       = GetLeavesToUpdate();
            Leave updatedLeave = null;

            leaves.ForEach(lv =>
            {
                if (lv.Id == leaveId)
                {
                    updatedLeave = lv;
                }
            });

            if (updatedLeave == null)
            {
                Console.WriteLine("Please enter valid Leave Id");
                return(false);
            }

            updatedLeave.Status = isApproved ? Status.Approved : Status.Rejected;

            return(Leave.Update(updatedLeave));
        }