Ejemplo n.º 1
0
 public JsonResult AddGallery(AddGalleryViewModel viewModel)
 {
     try
     {
         _galleryService.Create(ModelMapper.ConvertToModel(viewModel));
         return(Json(true));
     }
     catch (Exception)
     {
         return(Json(false));
     }
 }
Ejemplo n.º 2
0
        public HttpResponseMessage NewGalleriy([FromBody] string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(Request.CreateResponse(HttpStatusCode.NotAcceptable));
            }
            var galleriy = _galleryService.Create();

            galleriy.Name      = name;
            galleriy.IsDeleted = false;
            _galleryService.Add(galleriy);
            _unitOfWork.SaveChanges();


            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            return(response);
        }