Exemplo n.º 1
0
        public PictureViewModel GetSuitPicture(long id)
        {
            var picture = LocationProvider.GetPicture(id);

            var model = new PictureViewModel()
            {
                Id = picture.Id,
                Photo = picture.Photo
            };

            return model;
        }
Exemplo n.º 2
0
        public PictureViewModel SaveSuitPicture(PictureViewModel model)
        {
            try
            {
                if (!ModelState.IsValid)
                {
                    throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                       "Error details"));
                }
                var suit = LocationProvider.SavePicture(model.Id, model.Photo);
                var newSuit = new PictureViewModel()
                {
                    Id = suit.Id,
                    Photo = suit.Photo
                };

                return newSuit;
            }
            catch (Exception e)
            {
                throw new HttpResponseException(Request.CreateErrorResponse(HttpStatusCode.BadRequest, e.Message));
            }
        }