public async Task <StatusData <string> > Commit(ImageCropRequest cropRequest, SystemSession session)
        {
            var serviceCropRequest = new ElifImageCrop {
                Width = cropRequest.CropDetail.Width, Height = cropRequest.CropDetail.Height, Top = cropRequest.CropDetail.Top, Bottom = cropRequest.CropDetail.Bottom, Left = cropRequest.CropDetail.Left, Right = cropRequest.CropDetail.Right, SizeCodes = (SizedCodes)cropRequest.CropDetail.SizeCode
            };
            var response = await Task.Factory.StartNew(() => Client.ElifService.commit(cropRequest.FileId, serviceCropRequest, session.GetSession())).ConfigureAwait(false);

            var result = new StatusData <string> {
                Status = response ? SystemDbStatus.Updated : SystemDbStatus.NotModified
            };

            return(result);
        }
        ////public async Task<StatusData<bool>> Crop(ImageCropRequest cropRequest, SystemSession session)
        ////{
        ////    var serviceRequest = new Elif { FileId = cropRequest.FileId, AskWebp = cropRequest.AskWebp, Username = cropRequest.UserName };
        ////    var serviceCropRequest = new ElifImageCrop { Width = cropRequest.CropDetail.Width, Height = cropRequest.CropDetail.Height, Top = cropRequest.CropDetail.Top, Bottom = cropRequest.CropDetail.Bottom, Left = cropRequest.CropDetail.Left, Right = cropRequest.CropDetail.Right, SizeCodes = (SizedCodes)cropRequest.CropDetail.SizeCode };
        ////    var response = await Task.Factory.StartNew(() => Client.ElifService.doCrop(serviceRequest, serviceCropRequest, session.GetSession())).ConfigureAwait(false);
        ////    var result = new StatusData<bool> { Status = response ? SystemDbStatus.Updated : SystemDbStatus.NotModified, Data = response };
        ////    return result;
        ////}

        public async Task <StatusData <bool> > Crop(ImageCropRequest cropRequest, SystemSession session)
        {
            var result = new StatusData <bool> {
                Status = SystemDbStatus.Updated
            };
            var serviceRequest = new Elif {
                FileId = cropRequest.FileId, AskWebp = cropRequest.AskWebp, Username = cropRequest.UserName
            };
            var serviceCropRequest = new ElifImageCrop {
                Width = cropRequest.CropDetail.Width, Height = cropRequest.CropDetail.Height, Top = cropRequest.CropDetail.Top, Bottom = cropRequest.CropDetail.Bottom, Left = cropRequest.CropDetail.Left, Right = cropRequest.CropDetail.Right, SizeCodes = (SizedCodes)cropRequest.CropDetail.SizeCode
            };

            result.Data = await Task.Factory.StartNew(() => Client.ElifService.doCrop(serviceRequest, serviceCropRequest, session.GetSession())).ConfigureAwait(false);

            return(result);
        }
示例#3
0
        public async Task <HttpResponseMessage> ReCrop([FromBody] ImageCropRequest cropRequest)
        {
            var response = await _service.ReCrop(cropRequest, Request.GetSession()).ConfigureAwait(false);

            return(Request.SystemResponse <string>(response.Status));
        }
示例#4
0
 public Task <StatusData <string> > ReCrop(ImageCropRequest cropRequest, SystemSession session)
 {
     return(_jUnitOfWork.Media.ReCrop(cropRequest, session));
 }