예제 #1
0
    public string InsertImage(int serviceOnAirId, string image, string imageName)
    {
        try
        {
            Dictionary <string, object> res = new Dictionary <string, object>();
            string imageNameCombo           = serviceOnAirId + "_" + imageName;
            bool   imageSaved = ImageData.SaveImage(image, imageNameCombo, @"images/");
            if (imageSaved)
            {
                res = _service.CreateSuccessRes();
                _PathData.InsertImage(serviceOnAirId, IMG_PREFIX + imageNameCombo);
            }
            else
            {
                Exception ex = new Exception("Image didnt saved");
                res = _service.CreateErrorRes(ex);
            }

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