private void ChangeRequestsStatus(AnnouncementJoinRequestSupplierTemplate request, List <KeyValuePair <string, int> > modifiedCrs) { if (request.StatusId == (int)Enums.AnnouncementTemplateJoinRequestStatus.PendingAcceptance) { request.UpdateAnnouncementJoinRequest(_httpContextAccessor.HttpContext.User.UserId(), request.Id, (int)Enums.AnnouncementTemplateJoinRequestStatus.Accepted); modifiedCrs.Add(new KeyValuePair <string, int>(request.Cr, (int)Enums.AnnouncementTemplateJoinRequestStatus.Accepted)); } if (request.StatusId == (int)Enums.AnnouncementTemplateJoinRequestStatus.PendingRejection) { request.UpdateAnnouncementJoinRequest(_httpContextAccessor.HttpContext.User.UserId(), request.Id, (int)Enums.AnnouncementTemplateJoinRequestStatus.Rejected, request.RejectionReason); modifiedCrs.Add(new KeyValuePair <string, int>(request.Cr, (int)Enums.AnnouncementTemplateJoinRequestStatus.Rejected)); } }
public async Task <AnnouncementSuppliersTemplateJoinRequestsDetailsModel> SaveJoinRequestResult(AnnouncementSuppliersTemplateJoinRequestsDetailsModel joinRequestModel) { AnnouncementJoinRequestSupplierTemplate joinRequest = await _joinRequestQueries.GetAnnouncementJoinRequestByRequestId(joinRequestModel.JoinRequestId); joinRequest.UpdateAnnouncementJoinRequest(joinRequestModel.UserId, joinRequest.Id, joinRequestModel.RequestResultId, joinRequestModel.RejectionReason, joinRequestModel.Notes); await _joinRequestCommands.UpdateAnnouncementJoinRequestAsync(joinRequest); return(joinRequestModel); }
public void Should_UpdateAnnouncementJoinRequestSupplierTemplate() { var attachments = new List <AnnouncementTemplateJoinRequestAttachment> { new AnnouncementTemplateJoinRequestAttachment("name", "123") }; var announcementId = 1; var cr = "123"; var statusId = 1; var announcementJoinRequestSupplierTemplate = new AnnouncementJoinRequestSupplierTemplate(attachments, announcementId, cr, statusId); announcementJoinRequestSupplierTemplate.UpdateAnnouncementJoinRequest(1, 1, 2, "rejectReason", "notes"); announcementJoinRequestSupplierTemplate.ShouldNotBeNull(); announcementJoinRequestSupplierTemplate.AnnouncementId.ShouldBe(1); announcementJoinRequestSupplierTemplate.Cr.ShouldBe("123"); announcementJoinRequestSupplierTemplate.StatusId.ShouldBe(2); announcementJoinRequestSupplierTemplate.RejectionReason.ShouldBe("rejectReason"); announcementJoinRequestSupplierTemplate.Notes.ShouldBe("notes"); announcementJoinRequestSupplierTemplate.Attachments.Count.ShouldBeGreaterThanOrEqualTo(1); announcementJoinRequestSupplierTemplate.Attachments[0].Name.ShouldBe("name"); }