public IActionResult AddPastLeave([FromBody] PastLeaves leave) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } Person p = _repository.Employee.FindByCondition(x => x.Id == leave.PersonId); leave.EmployeeName = p.FirstName + " " + p.LastName; leave.TenantId = TenantId; _repository.LeaveRequest.AddPastLeave(leave); _repository.LeaveRequest.Dispose(); //_repository.LeaveRequest.UpdateRequestStatus(leave.Id, "Pending"); //SendMail(leave.Id, "Pending"); return(Ok()); }
public void AddPastLeave(PastLeaves pastLeave) { _dbContext.PastLeaves.Add(pastLeave); _dbContext.SaveChanges(); }