public virtual ActionResult DeleteAvatar(long profileId)
 {
     try
     {
         var profile = _personManagementService.FindProfile(profileId);
         if (profile == null)
         {
             return(Json(new { isError = true, Message = @"ورودی نامعتبر!" }));
         }
         var addressUrlFile = new AddressUrlFile(Server.MapPath("~//"));
         var path           = addressUrlFile.Image + profile.Avatar;
         profile.Avatar = "";
         var result = _personManagementService.UpdateProfile(profile);
         if (!result.Item1)
         {
             return(Json(new { isError = !result.Item1, Message = result.Item2 }));
         }
         if (System.IO.File.Exists(path))
         {
             System.IO.File.Delete(path);
         }
         return(Json(new { isError = !result.Item1, Message = result.Item2 }));
     }
     catch (Exception)
     {
         return(Json(new { isError = true, Message = @"خطا در حذف تصویر" }));
     }
 }
        public virtual ActionResult DeleteAvatar(long profileId)
        {
            try
            {
                var profile = _personManagementService.FindProfile(profileId);
                if (profile == null)
                {
                    return(Json(new { isError = true, Message = @"ورودی نامعتبر!" }));
                }

                profile.Avatar = "";
                var result = _personManagementService.UpdateProfile(profile);
                if (result.Item1 == false)
                {
                    var path = Server.MapPath("~\\Content\\Images\\Avatars\\" + profile.Avatar);
                    System.IO.File.Delete(path);
                }

                return(Json(new { isError = !result.Item1, Message = result.Item2 }));
            }
            catch (Exception)
            {
                return(Json(new { isError = true, Message = @"خطا در ویرایش اطلاعات پرسنلی" }));
            }
        }