public async Task <IActionResult> LeaveConfiguration([FromBody] PostNewLeaveConfiguration postNewLeaveConfiguration)
        {
            if (postNewLeaveConfiguration == null)
            {
                return(Json(new
                {
                    msg = "No Data"
                }
                            ));
            }

            var orgId = getOrg();
            var organisationDetails = await _context.Organisations.Where(x => x.Id == orgId).FirstOrDefaultAsync();

            int noOfEmployee = _context.Users.Where(x => x.OrganisationId == orgId).Count();

            try
            {
                LeaveConfiguration newLeaveConfiguration = new LeaveConfiguration()
                {
                    Id             = Guid.NewGuid(),
                    LeaveTitle     = postNewLeaveConfiguration.LeaveTitle,
                    Description    = postNewLeaveConfiguration.Description,
                    MaxDuration    = postNewLeaveConfiguration.MaxDuration,
                    MaxApplication = postNewLeaveConfiguration.MaxApplication,
                    OrganisationId = orgId
                };

                _context.Add(newLeaveConfiguration);
                _context.SaveChanges();


                return(Json(new
                {
                    msg = "Success"
                }
                            ));
            }
            catch (Exception ee)
            {
            }

            return(Json(
                       new
            {
                msg = "Fail"
            }));
        }
        public void GenerateSickLeaveTest()
        {
            Employee employee = new Employee("Test user");

            LeaveConfiguration leaveConfig = new LeaveConfiguration()
            {
                AmountDays     = 30,
                LeaveType      = LeaveType.Sick,
                LeaveEndOfLife = LeaveEndOfLife.Expire,
                ValidDays      = 365
            };

            LeaveGenerator generator = new LeaveGenerator();

            Leave leave = generator.Generate(employee, leaveConfig);

            Assert.IsNotNull(leave);
        }
        public void SaveOrUpdate(LeaveConfiguration leaveConfig)
        {
            if (leaveConfig.Id == 0)
            {
                leaveConfig.Id = LeaveConfigurations.Count + 1;
                LeaveConfigurations.Add(leaveConfig);
            }
            else
            {
                foreach (LeaveConfiguration t in LeaveConfigurations)
                {
                    if (t.Id != leaveConfig.Id)
                    {
                        continue;
                    }

                    t.AmountDays     = leaveConfig.AmountDays;
                    t.LeaveEndOfLife = leaveConfig.LeaveEndOfLife;
                    t.LeaveType      = leaveConfig.LeaveType;
                    t.ValidDays      = leaveConfig.ValidDays;
                }
            }
        }