Ejemplo n.º 1
0
    public string InsertProfilePicture(string UserId, string Image, string imageName)
    {
        try
        {
            Dictionary <string, object> res = new Dictionary <string, object>();
            string imageNameCombo           = UserId + "_Profile_" + imageName;
            bool   imageSaved = ImageData.SaveImage(Image, imageNameCombo, @"images/");
            if (imageSaved)
            {
                res = _service.CreateSuccessRes();
                res.Add("ProfilePicture", _service.ConvertDataTable(_Petsitterdata.InsertProfilePicture(UserId, IMG_PREFIX + imageNameCombo)));
            }
            else
            {
                Exception ex = new Exception("Image didnt save");
                res = _service.CreateErrorRes(ex);
            }

            return(_js.Serialize(res));
        }
        catch (Exception ex)
        {
            Dictionary <string, object> res = _service.CreateErrorRes(ex);
            return(_js.Serialize(res));
        }
    }