コード例 #1
0
        public async Task <IWrappedResponse> UpdateIsSortingRequired(int id, LoadCarrierReceiptsUpdateIsSortingRequiredRequest request)
        {
            var loadCarrierReceipt = _olmaLoadCarrierReceiptRepo.FindByCondition(r => r.Id == id && !r.IsDeleted)
                                     .IgnoreQueryFilters().Include(r => r.DplNotes).Single();

            if (loadCarrierReceipt.IsSortingRequired != request.IsSortingRequired)
            {
                loadCarrierReceipt.IsSortingRequired = request.IsSortingRequired;
                if (request.DplNote != null && request.DplNote.UserId != 0)
                {
                    loadCarrierReceipt.DplNotes ??= new List <Olma.EmployeeNote>();
                    loadCarrierReceipt.DplNotes.Add(Mapper.Map <Olma.EmployeeNote>(request.DplNote));
                }
                _olmaLoadCarrierReceiptRepo.Save();
            }

            var result = Mapper.Map <LoadCarrierReceipt>(loadCarrierReceipt);

            return(Ok(result));
        }
コード例 #2
0
 [HasPermission(typeof(AttributeRequirement <CanCancelLoadCarrierReceiptRequirement>))] //TODO Requirement for Set IsSortingRequired on LoadCarrierReceipts
 public Task <ActionResult <LoadCarrierReceipt> > PatchLoadCarrierReceiptIsSortingRequired(int id, [FromBody] LoadCarrierReceiptsUpdateIsSortingRequiredRequest request)
 {
     if (request != null && request.DplNote != null && _authData.GetUserRole() == UserRole.DplEmployee)
     {
         request.DplNote.UserId = _authData.GetUserId();
     }
     return(this._loadCarrierReceiptsService.UpdateIsSortingRequired(id, request)
            .Convert <LoadCarrierReceipt>(this));
 }