Exemplo n.º 1
0
        public async Task <bool> UpdateAvatar(ImageFile imageFile)
        {
            DateTime dDateNow = DateTime.Now;
            Dictionary <string, object> infoParameters = new Dictionary <string, object>();
            ImageControl ImgCtrl = new ImageControl();

            infoParameters.Add("Id", this.Id);
            infoParameters.Add("pictureName", imageFile.FileName);

            var imDelTsk  = ImgCtrl.DeleteImageAsync("users", this.Picture);
            var imgUpdTsk = ImgCtrl.UploadImageAsync(imageFile);
            var imgUpd    = false;
            var imgDel    = false;
            var tableUpd  = false;

            try
            {
                DataTable oUserData = DBConn.ExecuteCommand("sp_UserDetails_UpdateAvatar", infoParameters).Tables[0];
                if (oUserData.HasErrors)
                {
                    this.sMsgError.Add(oUserData.GetErrors().ToString());
                    tableUpd = false;
                }

                tableUpd = true;
                imgDel   = await imDelTsk;
                imgUpd   = await imgUpdTsk;
            }
            catch (Exception error)
            {
                this.sMsgError.Add(error.Message);
                return(false);
            }

            return(imgUpd && tableUpd);
        }
Exemplo n.º 2
0
 public async Task <bool> UploadImageAsync(ImageFile File)
 {
     return(UploadImg(File));
 }
Exemplo n.º 3
0
 public bool UploadImage(ImageFile File)
 {
     return(UploadImg(File));
 }