Exemple #1
0
        public void Then_If_It_Is_An_Existing_Commitment_And_The_Allowed_Updated_Values_Are_Changed_True_Is_Retruned()
        {
            //Arrange
            var commitment = new CommitmentModel
            {
                EmployerAccountId    = 12345,
                ApprenticeName       = "Mr Test Tester",
                ApprenticeshipId     = 88775544,
                ActualEndDate        = DateTime.Today.AddMonths(11),
                StartDate            = DateTime.Today,
                PlannedEndDate       = DateTime.Today.AddMonths(12),
                MonthlyInstallment   = 10m,
                CompletionAmount     = 100m,
                NumberOfInstallments = 12
            };
            var employerCommitment = new EmployerCommitment(new CommitmentModel {
                Id = 65421
            });

            //Act
            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsTrue(actual);
            Assert.AreEqual(commitment.ApprenticeName, employerCommitment.ApprenticeName);
            Assert.AreEqual(commitment.ApprenticeshipId, employerCommitment.ApprenticeshipId);
            Assert.AreEqual(commitment.StartDate, employerCommitment.StartDate);
            Assert.AreEqual(commitment.PlannedEndDate, employerCommitment.PlannedEndDate);
            Assert.AreEqual(commitment.MonthlyInstallment, employerCommitment.MonthlyInstallment);
            Assert.AreEqual(commitment.CompletionAmount, employerCommitment.CompletionAmount);
            Assert.AreEqual(commitment.NumberOfInstallments, employerCommitment.NumberOfInstallments);
        }
        public CommitmentModel MapToCommitment(ApprenticeshipMessage message)
        {
            var model = new CommitmentModel
            {
                EmployerAccountId        = message.EmployerAccountId,
                ApprenticeshipId         = message.ApprenticeshipId,
                LearnerId                = message.LearnerId,
                StartDate                = message.StartDate,
                PlannedEndDate           = message.PlannedEndDate,
                ActualEndDate            = message.ActualEndDate,
                CompletionAmount         = message.CompletionAmount,
                MonthlyInstallment       = message.MonthlyInstallment,
                NumberOfInstallments     = (short)message.NumberOfInstallments,
                ProviderId               = message.ProviderId,
                ProviderName             = message.ProviderName,
                ApprenticeName           = message.ApprenticeName,
                CourseName               = message.CourseName,
                CourseLevel              = message.CourseLevel,
                SendingEmployerAccountId = message.SendingEmployerAccountId ?? message.EmployerAccountId,
                FundingSource            = message.FundingSource,
                UpdatedDateTime          = DateTime.UtcNow,
                HasHadPayment            = false
            };

            return(model);
        }
Exemple #3
0
        private void CreateCommitmentModel(decimal monthlyInstallment, decimal completionAmount)
        {
            _commitment = new CommitmentModel
            {
                EmployerAccountId    = 1,
                ApprenticeshipId     = 2,
                LearnerId            = 3,
                StartDate            = DateTime.Today.AddMonths(-1),
                PlannedEndDate       = DateTime.Today.AddMonths(25),
                MonthlyInstallment   = monthlyInstallment,
                NumberOfInstallments = 4,
                CompletionAmount     = completionAmount,
                FundingSource        = Models.Payments.FundingSource.Levy
            };
            _commitments = new EmployerCommitmentsModel
            {
                LevyFundedCommitments = new List <CommitmentModel>
                {
                    _commitment
                }
            };
            var employerCommitments = new EmployerCommitments(1, _commitments);

            Moqer.SetInstance(employerCommitments);
        }
Exemple #4
0
        public CommitmentModel MapToCommitment(PaymentCreatedMessage paymentCreatedMessage)
        {
            var model = new CommitmentModel
            {
                EmployerAccountId        = paymentCreatedMessage.EmployerAccountId,
                ApprenticeshipId         = paymentCreatedMessage.ApprenticeshipId,
                LearnerId                = paymentCreatedMessage.Uln,
                StartDate                = paymentCreatedMessage.EarningDetails.StartDate,
                PlannedEndDate           = paymentCreatedMessage.EarningDetails.PlannedEndDate,
                ActualEndDate            = null,
                CompletionAmount         = paymentCreatedMessage.EarningDetails.CompletionAmount,
                MonthlyInstallment       = paymentCreatedMessage.EarningDetails.MonthlyInstallment,
                NumberOfInstallments     = (short)paymentCreatedMessage.EarningDetails.TotalInstallments,
                ProviderId               = paymentCreatedMessage.Ukprn,
                ProviderName             = paymentCreatedMessage.ProviderName,
                ApprenticeName           = paymentCreatedMessage.ApprenticeName,
                CourseName               = paymentCreatedMessage.CourseName,
                CourseLevel              = paymentCreatedMessage.CourseLevel,
                SendingEmployerAccountId = paymentCreatedMessage.SendingEmployerAccountId,
                FundingSource            = FundingSourceConverter.ConvertToPaymentsFundingSource(paymentCreatedMessage.FundingSource),
                HasHadPayment            = true,
                UpdatedDateTime          = DateTime.UtcNow
            };

            return(model);
        }
Exemple #5
0
        public async Task Then_The_Commitment_Is_Not_Stored_If_The_Registration_Check_Fails()
        {
            //Arrange
            _commitmentModel = new CommitmentModel
            {
                ApprenticeshipId  = ExpectedApprenticeshipId,
                EmployerAccountId = ExpectedEmployerAccountId,
                ActualEndDate     = null,
                Id = 3322,
                CompletionAmount = 100
            };
            _paymentMapper.Setup(x =>
                                 x.MapToCommitment(It.Is <PaymentCreatedMessage>(c =>
                                                                                 c.EmployerAccountId.Equals(ExpectedEmployerAccountId))))
            .Returns(_commitmentModel);
            _employerCommitment = new EmployerCommitment(_commitmentModel);
            _employerCommitmentRepostiory.Setup(x => x.Get(ExpectedEmployerAccountId, ExpectedApprenticeshipId))
            .ReturnsAsync(_employerCommitment);
            _handler = new Application.Commitments.Handlers.StoreCommitmentHandler(_employerCommitmentRepostiory.Object, _logger.Object, _paymentMapper.Object, new Mock <ITelemetry>().Object, new Apprenticeship.Mapping.ApprenticeshipMapping(), _queueServiceMock.Object);

            //Act
            await _handler.Handle(_message, _allowProjectionQueueName);

            //Assert
            _queueServiceMock.Verify(v => v.SendMessageWithVisibilityDelay(It.Is <PaymentCreatedMessage>(m => m == _message), It.Is <string>(s => s == _allowProjectionQueueName)), Times.Never);
            _employerCommitmentRepostiory.Verify(x => x.Store(It.IsAny <EmployerCommitment>()), Times.Never());
        }
Exemple #6
0
        public void Then_The_ActualEndDate_Is_Not_Updated(Status status)
        {
            var dbActualEndDate      = DateTime.Now.AddDays(-1);
            var paymentActualEndDate = DateTime.Now.AddDays(-2);
            var commitment           = new CommitmentModel
            {
                EmployerAccountId    = 12345,
                ApprenticeName       = "Mr Test Tester",
                ApprenticeshipId     = 88775544,
                ActualEndDate        = paymentActualEndDate,
                StartDate            = DateTime.Today,
                PlannedEndDate       = DateTime.Today.AddMonths(12),
                MonthlyInstallment   = 10m,
                CompletionAmount     = 100m,
                NumberOfInstallments = 12
            };

            var employerCommitment = new EmployerCommitment(new CommitmentModel {
                Id = 65421, Status = status, ActualEndDate = dbActualEndDate
            });

            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsTrue(actual);
            Assert.AreEqual(dbActualEndDate, employerCommitment.ActualEndDate);
        }
Exemple #7
0
        public void SetUp()
        {
            Moqer    = new AutoMoqer();
            _account = new Account(1, 12000, 300, 0, 0);
            Moqer.SetInstance(_account);
            _commitment = new CommitmentModel
            {
                EmployerAccountId    = 1,
                ApprenticeshipId     = 2,
                LearnerId            = 3,
                StartDate            = DateTime.Today.AddMonths(-1),
                PlannedEndDate       = DateTime.Today.AddMonths(25),
                MonthlyInstallment   = 2100,
                NumberOfInstallments = 24,
                CompletionAmount     = 3000,
                FundingSource        = Models.Payments.FundingSource.Levy
            };
            _commitments = new EmployerCommitmentsModel
            {
                LevyFundedCommitments = new List <CommitmentModel>
                {
                    _commitment
                }
            };
            var employerCommitments = new EmployerCommitments(1, _commitments);

            Moqer.SetInstance(employerCommitments);
        }
        public async Task Store(CommitmentModel commitment)
        {
            try
            {
                _logger.Info($"Store Commitment Id {commitment.Id}");
                var startTime = DateTime.UtcNow;
                var stopwatch = new Stopwatch();
                stopwatch.Start();
                if (commitment.Id <= 0)
                {
                    _dataContext.Commitments.Add(commitment);
                }

                await _dataContext.SaveChangesAsync();

                stopwatch.Stop();

                _telemetry.TrackDependency(DependencyType.SqlDatabaseQuery, "Store Commitment", startTime, stopwatch.Elapsed, true);
            }
            catch (DbEntityValidationException ex)
            {
                var errorMessages    = ex.EntityValidationErrors.SelectMany(x => x.ValidationErrors).Select(x => x.ErrorMessage);
                var fullErrorMessage = string.Join("; ", errorMessages);
                var exceptionMessage = string.Concat(ex.Message, " The validation errors are: ", fullErrorMessage);
                _logger.Error(ex, exceptionMessage);
            }
            catch (Exception ex)
            {
                _logger.Error(ex, $"Store Commitment Failed for CommitmentId {commitment.Id}");
            }
        }
        private static bool GetFilterUnpaid(CommitmentModel commitment)
        {
            var limitEndDate = DateTime.Today.GetStartOfMonth();

            return(commitment.ActualEndDate == null &&
                   commitment.HasHadPayment &&
                   commitment.PlannedEndDate.GetStartOfMonth().AddMonths(1) == limitEndDate);
        }
Exemple #10
0
        public static async Task UpdateCommitment(this AppDbContext db, CommitmentModel model)
        {
            if (await model.Validate(db))
            {
                var commitment = await db.Commitments.FindAsync(model.id);

                commitment.Category.Id = model.category.id;
                await db.SaveChangesAsync();
            }
        }
Exemple #11
0
        public static Task <bool> Validate(this CommitmentModel model, AppDbContext db)
        {
            return(Task.Run(() =>
            {
                if (model.startDate >= model.endDate)
                {
                    throw new Exception("Start Date must occur before End Date");
                }

                return true;
            }));
        }
Exemple #12
0
        public void Then_If_No_EmployerAccountId_Has_Been_Supplied_False_Is_Returned()
        {
            //Arrange
            var commitment = new CommitmentModel
            {
                EmployerAccountId = 0,
                ApprenticeName    = "Mr Test Tester"
            };
            var employerCommitment = new EmployerCommitment(new CommitmentModel());

            //Act
            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsFalse(actual);
        }
Exemple #13
0
        public void Then_If_It_Is_A_New_Commitment_With_An_AcutalEndDate_Then_False_Is_Returned()
        {
            //Arrange
            var commitment = new CommitmentModel
            {
                Id            = 554433,
                ActualEndDate = DateTime.Today
            };
            var employerCommitment = new EmployerCommitment(new CommitmentModel());

            //Act
            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsFalse(actual);
        }
Exemple #14
0
        public void Then_The_Values_Are_Mapped_And_Updated_If_Valid()
        {
            //Arrange
            var commitment = new CommitmentModel
            {
                Id                       = 554433,
                ApprenticeName           = "Tester",
                ApprenticeshipId         = 774411,
                CompletionAmount         = 5432m,
                CourseLevel              = 3,
                CourseName               = "Test"
                , EmployerAccountId      = 55443,
                FundingSource            = FundingSource.Transfer,
                LearnerId                = 12345,
                MonthlyInstallment       = 10m,
                NumberOfInstallments     = 10,
                PlannedEndDate           = DateTime.Today.AddMonths(12),
                StartDate                = DateTime.Today,
                ProviderId               = 443322,
                ProviderName             = "Test Provider",
                SendingEmployerAccountId = 12233
            };
            var employerCommitment = new EmployerCommitment(new CommitmentModel());

            //Act
            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsTrue(actual);
            Assert.AreEqual(commitment.ActualEndDate, employerCommitment.ActualEndDate);
            Assert.AreEqual(commitment.ApprenticeName, employerCommitment.ApprenticeName);
            Assert.AreEqual(commitment.ApprenticeshipId, employerCommitment.ApprenticeshipId);
            Assert.AreEqual(commitment.CompletionAmount, employerCommitment.CompletionAmount);
            Assert.AreEqual(commitment.CourseLevel, employerCommitment.CourseLevel);
            Assert.AreEqual(commitment.CourseName, employerCommitment.CourseName);
            Assert.AreEqual(commitment.EmployerAccountId, employerCommitment.EmployerAccountId);
            Assert.AreEqual(commitment.FundingSource, employerCommitment.FundingSource);
            Assert.AreEqual(commitment.LearnerId, employerCommitment.LearnerId);
            Assert.AreEqual(commitment.MonthlyInstallment, employerCommitment.MonthlyInstallment);
            Assert.AreEqual(commitment.NumberOfInstallments, employerCommitment.NumberOfInstallments);
            Assert.AreEqual(commitment.PlannedEndDate, employerCommitment.PlannedEndDate);
            Assert.AreEqual(commitment.StartDate, employerCommitment.StartDate);
            Assert.AreEqual(commitment.ProviderId, employerCommitment.ProviderId);
            Assert.AreEqual(commitment.ProviderName, employerCommitment.ProviderName);
            Assert.AreEqual(commitment.SendingEmployerAccountId, employerCommitment.SendingEmployerAccountId);
        }
Exemple #15
0
        public void Then_If_It_Is_A_New_Commitment_And_An_ActualEndDate_Has_Been_Supplied_False_Is_Returned()
        {
            //Arrange
            var commitment = new CommitmentModel
            {
                EmployerAccountId = 12345,
                ApprenticeName    = "Mr Test Tester",
                ActualEndDate     = DateTime.Today
            };
            var employerCommitment = new EmployerCommitment(new CommitmentModel());

            //Act
            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsFalse(actual);
        }
Exemple #16
0
        public void Then_If_The_AcutalEndDate_ApprenticeshipName_Or_ApprenticeshipId_Have_Not_Changed_False_Is_Returned()
        {
            //Arrange
            var commitment = new CommitmentModel
            {
                Id = 554433,
                EmployerAccountId = 12345,
                ApprenticeName    = "Tester",
                ApprenticeshipId  = 774411,
                ActualEndDate     = DateTime.Today
            };
            var employerCommitment = new EmployerCommitment(commitment);

            //Act
            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsFalse(actual);
        }
Exemple #17
0
        public static async Task AddCommitment(this AppDbContext db, CommitmentModel model)
        {
            if (await model.Validate(db))
            {
                var commitment = new Commitment
                {
                    Id         = model.id,
                    Location   = model.location,
                    Subject    = model.subject,
                    Body       = model.body,
                    StartDate  = model.startDate,
                    EndDate    = model.endDate,
                    CategoryId = model.category.id
                };

                await db.Commitments.AddAsync(commitment);

                await db.SaveChangesAsync();
            }
        }
Exemple #18
0
        public static async Task <CommitmentModel> GetSimpleCommitment(this AppDbContext db, int id)
        {
            var commitment = await db.Commitments.Include(x => x.Category).FirstOrDefaultAsync(x => x.Id == id);

            var model = new CommitmentModel
            {
                id       = commitment.Id,
                location = commitment.Location,
                subject  = commitment.Subject,
                body     = commitment.Body,
                category = new CategoryModel
                {
                    id   = commitment.CategoryId,
                    name = commitment.Category.Name
                },
                startDate = commitment.StartDate,
                endDate   = commitment.EndDate
            };

            return(model);
        }
        public ApprenticeshipCsvItemViewModel ToCsvApprenticeship(CommitmentModel commitment, long accountId)
        {
            var model = new ApprenticeshipCsvItemViewModel
            {
                DasStartDate      = commitment.StartDate.ToString("MMM-yy"),
                DasPlannedEndDate = commitment.PlannedEndDate.ToString("MMM-yy"),

                Apprenticeship      = commitment.CourseName,
                ApprenticeshipLevel = commitment.CourseLevel,
                TransferToEmployer  = commitment.FundingSource == FundingSource.Transfer ? "Y" : "N",
                Uln                 = IsTransferCommitment(commitment, accountId) ? "" : commitment.LearnerId.ToString(),
                ApprenticeName      = IsTransferCommitment(commitment, accountId) ? "" : commitment.ApprenticeName,
                UkPrn               = commitment.ProviderId,
                ProviderName        = commitment.ProviderName,
                TotalCost           = Convert.ToInt32((commitment.MonthlyInstallment * commitment.NumberOfInstallments) + commitment.CompletionAmount),
                MonthlyTrainingCost = Convert.ToInt32(commitment.MonthlyInstallment),
                CompletionAmount    = Convert.ToInt32(commitment.CompletionAmount)
            };

            if (commitment.HasHadPayment)
            {
                model.StartDate      = commitment.StartDate.ToString("MMM-yy");
                model.PlannedEndDate = commitment.PlannedEndDate.ToString("MMM-yy");
                model.Status         = "Live and paid";
            }
            else
            {
                model.DasStartDate      = commitment.StartDate.ToString("MMM-yy");
                model.DasPlannedEndDate = commitment.PlannedEndDate.ToString("MMM-yy");
                model.Status            =
                    commitment.StartDate > DateTime.Today
                    ? "Waiting to start"
                    : "Live and not paid";
            }

            return(model);
        }
Exemple #20
0
        public void Then_The_Status_Is_NotChange_For_An_Existing_Record(Status?status)
        {
            var commitment = new CommitmentModel
            {
                EmployerAccountId    = 12345,
                ApprenticeName       = "Mr Test Tester",
                ApprenticeshipId     = 88775544,
                StartDate            = DateTime.Today,
                PlannedEndDate       = DateTime.Today.AddMonths(12),
                MonthlyInstallment   = 10m,
                CompletionAmount     = 100m,
                NumberOfInstallments = 12
            };

            var employerCommitment = new EmployerCommitment(new CommitmentModel {
                Id = 65421, Status = status, ApprenticeshipId = 88775544
            });

            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsTrue(actual);
            Assert.AreEqual(status, employerCommitment.Status);
        }
Exemple #21
0
        public void Then_The_Status_Is_LiveOrWaitingToStart_For_A_New_Record()
        {
            var commitment = new CommitmentModel
            {
                EmployerAccountId    = 12345,
                ApprenticeName       = "Mr Test Tester",
                ApprenticeshipId     = 88775544,
                StartDate            = DateTime.Today,
                PlannedEndDate       = DateTime.Today.AddMonths(12),
                MonthlyInstallment   = 10m,
                CompletionAmount     = 100m,
                NumberOfInstallments = 12
            };

            var employerCommitment = new EmployerCommitment(new CommitmentModel {
                Id = 0
            });

            var actual = employerCommitment.RegisterCommitment(commitment);

            //Assert
            Assert.IsTrue(actual);
            Assert.AreEqual(Status.LiveOrWaitingToStart, employerCommitment.Status);
        }
Exemple #22
0
        public void Arrange()
        {
            _message = new PaymentCreatedMessage
            {
                EmployerAccountId = ExpectedEmployerAccountId,
                ApprenticeshipId  = ExpectedApprenticeshipId,
                EarningDetails    = new EarningDetails()
            };
            _commitmentModel = new CommitmentModel
            {
                EmployerAccountId = ExpectedEmployerAccountId,
                CompletionAmount  = 100
            };

            _employerCommitment = new EmployerCommitment(_commitmentModel);

            _employerCommitmentRepostiory = new Mock <IEmployerCommitmentRepository>();

            _logger = new Mock <ILog>();

            _paymentMapper = new Mock <IPaymentMapper>();
            _paymentMapper.Setup(x =>
                                 x.MapToCommitment(It.Is <PaymentCreatedMessage>(c =>
                                                                                 c.EmployerAccountId.Equals(ExpectedEmployerAccountId))))
            .Returns(_commitmentModel);
            _employerCommitmentRepostiory.Setup(x => x.Get(ExpectedEmployerAccountId, ExpectedApprenticeshipId))
            .ReturnsAsync(_employerCommitment);

            _queueServiceMock = new Mock <IQueueService>();
            _handler          = new Application.Commitments.Handlers.StoreCommitmentHandler(
                _employerCommitmentRepostiory.Object,
                _logger.Object,
                _paymentMapper.Object,
                new Mock <ITelemetry>().Object,
                new Apprenticeship.Mapping.ApprenticeshipMapping(), _queueServiceMock.Object);
        }
 private static bool IsTransferCommitment(CommitmentModel commitmentModel, long accountId)
 {
     return(commitmentModel.FundingSource.Equals(FundingSource.Transfer) && commitmentModel.SendingEmployerAccountId == accountId);
 }
 public EmployerCommitment(CommitmentModel commitment)
 {
     Commitment = commitment ?? throw new ArgumentNullException(nameof(commitment));
 }
        public bool RegisterCommitment(CommitmentModel model)
        {
            if (model.EmployerAccountId <= 0)
            {
                return(false);
            }

            if (model.ActualEndDate.HasValue && model.ActualEndDate == DateTime.MinValue && Commitment.Status != Models.Commitments.Status.Completed && Commitment.Status != Models.Commitments.Status.Stopped)
            {
                model.ActualEndDate = null;
            }

            if (Commitment.Id == 0 && model.ActualEndDate != null)
            {
                return(false);
            }

            if (Commitment.Id != 0 &&
                (model.ActualEndDate != Commitment.ActualEndDate ||
                 model.ApprenticeName != Commitment.ApprenticeName ||
                 model.ApprenticeshipId != Commitment.ApprenticeshipId ||
                 model.StartDate != Commitment.StartDate ||
                 model.PlannedEndDate != Commitment.PlannedEndDate ||
                 model.MonthlyInstallment != Commitment.MonthlyInstallment ||
                 model.CompletionAmount != Commitment.CompletionAmount ||
                 model.NumberOfInstallments != Commitment.NumberOfInstallments ||
                 model.HasHadPayment != Commitment.HasHadPayment))
            {
                //don't update the actual end date - as the Actual EndDate updated from the das-forecasting-jobs event handlers
                Commitment.ApprenticeName       = model.ApprenticeName;
                Commitment.ApprenticeshipId     = model.ApprenticeshipId;
                Commitment.StartDate            = model.StartDate;
                Commitment.PlannedEndDate       = model.PlannedEndDate;
                Commitment.MonthlyInstallment   = model.MonthlyInstallment;
                Commitment.CompletionAmount     = model.CompletionAmount;
                Commitment.NumberOfInstallments = model.NumberOfInstallments;
                Commitment.UpdatedDateTime      = model.UpdatedDateTime;
                Commitment.HasHadPayment        = model.HasHadPayment;
                return(true);
            }

            if (Commitment.Id != 0)
            {
                return(false);
            }

            Commitment.ApprenticeshipId         = model.ApprenticeshipId;
            Commitment.ApprenticeName           = model.ApprenticeName;
            Commitment.LearnerId                = model.LearnerId;
            Commitment.CourseLevel              = model.CourseLevel;
            Commitment.CourseName               = model.CourseName;
            Commitment.ProviderId               = model.ProviderId;
            Commitment.ProviderName             = model.ProviderName;
            Commitment.StartDate                = model.StartDate;
            Commitment.PlannedEndDate           = model.PlannedEndDate;
            Commitment.MonthlyInstallment       = model.MonthlyInstallment;
            Commitment.CompletionAmount         = model.CompletionAmount;
            Commitment.NumberOfInstallments     = model.NumberOfInstallments;
            Commitment.SendingEmployerAccountId = model.SendingEmployerAccountId;
            Commitment.FundingSource            = model.FundingSource;
            Commitment.EmployerAccountId        = model.EmployerAccountId;
            Commitment.UpdatedDateTime          = model.UpdatedDateTime;
            Commitment.HasHadPayment            = model.HasHadPayment;
            Commitment.Status = Models.Commitments.Status.LiveOrWaitingToStart;
            return(true);
        }
        private static bool GetFilter(CommitmentModel commitment)
        {
            var limitEndDate = DateTime.Today.GetStartOfMonth();

            return(commitment.PlannedEndDate.GetStartOfMonth().AddMonths(1) < limitEndDate);
        }
Exemple #27
0
        public async Task <ObjectResult> UpdateCommittment([FromBody] CommitmentModel model)
        {
            await db.UpdateCommitment(model);

            return(Created("/api/Commitments/UpdateCommitment", model));
        }