public ActionResult Index(HttpPostedFileBase file, UploadingPictureViewModel model)
        {
            if (file != null && file.ContentLength > 0)
                try
                {
                    string cookie = HttpContext.Request.Cookies["sessionId"].Value;
                    var userId = SessionHelper.GetAuthorizedUser(cookie);
                    if (userId == null)
                        return View("~//Views//Shared//Error.cshtml", new ErrorViewModel() { Message = "Unauthorized", StatusCode = HttpStatusCode.Unauthorized });

                    PictureClient pictureClient = new PictureClient();
                    var picture = new PictureDto() { AuthorId = userId.Value, Description = model.Description, Title = model.Name };
                    picture.PictureContent = PictureHelper.GetBytesFromStream(file);
                    picture.FileFormat = file.ContentType;
                    var resp = pictureClient.Create(picture, cookie);
                    ViewBag.Message = "File uploaded successfully";
                }
                catch (Exception ex)
                {
                    return View("~//Views//Shared//Error.cshtml", new ErrorViewModel() { Message = ex.Message, StatusCode = HttpStatusCode.ServiceUnavailable });
                }
            else
            {
                ViewBag.Message = "You have not specified a file.";
            }

            var picturesModel = GetPictures();
            if (picturesModel == null)
                return View("~//Views//Shared//Error.cshtml", new ErrorViewModel() { Message = "Unauthorized", StatusCode = HttpStatusCode.Unauthorized });
            return View("~//Views//MyPictures//Index.cshtml", picturesModel);
        }
 public ActionResult UploadImage()
 {
     try
     {
         UploadingPictureViewModel model = new UploadingPictureViewModel();
         model.Description = "";
         model.Name = "";
         return View(model);
     }
     catch (Exception ex)
     {
         return View("~//Views//Shared//Error.cshtml", new ErrorViewModel() { Message = ex.Message, StatusCode = HttpStatusCode.ServiceUnavailable });
     }
 }