public JsonResult AddGallery(AddGalleryViewModel viewModel)
 {
     try
     {
         _galleryService.Create(ModelMapper.ConvertToModel(viewModel));
         return(Json(true));
     }
     catch (Exception)
     {
         return(Json(false));
     }
 }
Exemple #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);
        }