public BaseResponse UpdatePhoto(AircrewPhotoRequest request)
        {
            var aircrew = aircrewRepository.GetAircrewByKey(request.TransactionNumber);

            aircrew.Photo        = request.PhotoBinary;
            aircrew.LastEditDate = DateTime.Now;
            aircrew.LastEditUser = request.ActionUserID;

            return(this.Update(aircrew));
        }
        private async void CreatePhoto()
        {
            var openDialog = new OpenFileDialog
            {
                Filter      = "All Image Files|*.bmp;*.gif;*.jpeg;*.jpg;*.png;*.tif",
                FilterIndex = 0
            };

            if (openDialog.ShowDialog().GetValueOrDefault(false))
            {
                string filePath = openDialog.FileName;
                try
                {
                    MemoryStream m  = new MemoryStream();
                    Bitmap       bp = new Bitmap(filePath);
                    bp.Save(m, bp.RawFormat);
                    byte[] b = m.GetBuffer();
                    if (b.Length > 1024 * 1024 * MAXPHOTODSIZE)
                    {
                        this.ShowMessage(string.Format(CommonMsgResource.Msg_ImageOverSize, MAXPHOTODSIZE));
                        return;
                    }
                    string base64string = Convert.ToBase64String(b);

                    var request = new AircrewPhotoRequest
                    {
                        TransactionNumber = this.AircrewModel.TransactionNumber,
                        ActionUserID      = CPApplication.CurrentUser.UserName,
                        PhotoBinary       = base64string
                    };

                    await this.facade.UpdateAircrewPhoto(request);

                    this.ShowMessage(CommonMsgResource.Msg_SetSucess);
                    this.aircrewEntity = await this.facade.GetAircrewByKey(this.AircrewModel.TransactionNumber);

                    this.AircrewModel = AutoMapper.Mapper.Map <AircrewEntity, AircrewModel>(aircrewEntity);
                    this.ConvertPhotoToShow();
                }
                catch
                {
                    this.ShowMessage(CommonMsgResource.Msg_FileException);
                }
            }
        }
 public async Task <BaseResponse> UpdateAircrewPhoto(AircrewPhotoRequest request)
 {
     return(await this.PutAsync <AircrewPhotoRequest, BaseResponse>("photoupdate", request));
 }
 public BaseResponse UpdateAircrewPhoto(AircrewPhotoRequest request)
 {
     return(aircrewManageService.UpdatePhoto(request));
 }