Exemplo n.º 1
0
        public async Task <IActionResult> AllListDenial()
        {
            string userId = _httpContextAccessor.HttpContext.Request.Cookies["UserId"];
            AllListDenialResponse response = _iPP_OTService.AllListDenial(Convert.ToInt32(userId));

            return(Ok(response));
        }
Exemplo n.º 2
0
        public AllListDenialResponse AllListDenial(int UserId)
        {
            AllListDenialResponse response = new AllListDenialResponse();

            try
            {
                var UserData  = context.TblUsersRepository.Get().SingleOrDefault(q => q.UserId == UserId);
                var staffList = context.TblFmOvertimeRequestStaffRepository.Get().Where(q => q.Confirmation == null).ToList();
                if (staffList != null && staffList.Count > 0)
                {
                    //Fazla Mesai listesini onayla
                    foreach (var staff in staffList)
                    {
                        staff.ModifiedBy             = UserData.UserAccount;
                        staff.ModifiedDate           = DateTime.Now;
                        staff.Confirmation           = false;
                        staff.ConfirmationModifiedBy = UserData.UserAccount;
                        context.TblFmOvertimeRequestStaffRepository.Update(staff);
                        context.Save();
                    }
                    response.isSuccess = true;
                }
                else
                {
                    response.isSuccess    = false;
                    response.ErrorMessage = "Rededilecek fazla mesai bulunamadı!";
                }
            }
            catch (Exception)
            {
                response.isSuccess    = false;
                response.ErrorMessage = "Hata oluştu tekrar deneyiniz!";
            }

            return(response);
        }