コード例 #1
0
ファイル: LeavesController.cs プロジェクト: xprasoulas/grid
        public ActionResult Get(int id)
        {
            var apiResult = TryExecute(() => _leaveRepository.Get(id, "CreatedByUser.Person,RequestedForUser.User.Person,Approver.User.Person,LeaveType"), "Leave fetched sucessfully");
            var json      = JsonConvert.SerializeObject(apiResult, Formatting.None, new JsonSerializerSettings {
                ReferenceLoopHandling = ReferenceLoopHandling.Ignore
            });

            return(Content(json, "application/json"));
        }
コード例 #2
0
        public bool Reject(int leaveId, int approverId, string approverComments)
        {
            var leave = _leaveRepository.Get(leaveId);

            leave.Status           = LeaveStatus.Rejected;
            leave.ApproverId       = approverId;
            leave.ApproverComments = approverComments;
            leave.ActedOn          = DateTime.UtcNow;
            _leaveRepository.Update(leave);
            _unitOfWork.Commit();
            return(true);
        }
コード例 #3
0
        public async Task <IActionResult> UpdateLeaves(int id, [FromBody] LeaveResource LeaveResource)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var Leaves = await _repo.Get(id);

            if (Leaves == null)
            {
                return(NotFound());
            }
            _mapper.Map <LeaveResource, Leaves>(LeaveResource, Leaves);
            await _unitofwork.CompleteAsync();

            return(StatusCode(202));
        }
コード例 #4
0
 // GET: api/Leaves
 public IEnumerable <Leave> Get()
 {
     return(_leaveRepository.Get());
 }
コード例 #5
0
ファイル: LeaveService.cs プロジェクト: ATZakir/AttendanceNew
 public bool CheckIsExist(Leave leave)
 {
     return(leaveRepository.Get(chk => chk.EmployeeId == leave.EmployeeId && chk.LeaveTypeId == leave.LeaveTypeId && chk.StartDate == leave.StartDate && chk.EndDate == leave.EndDate) == null ? false : true);
 }
コード例 #6
0
 public List <Leave> Get()
 {
     return(_leaveRepository.Get());
 }
コード例 #7
0
ファイル: LeaveController.cs プロジェクト: N412/esuhai
 public Task <Leave> Get(int id)
 {
     return(_repo.Get(id));
 }