private async void AddPublisher()
        {
            var publisher = new Publisher()
            {
                Name = Name
            };
            await _service.AddPublisherAsync(publisher);

            Name = "";
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("Name,Location, LogoUrl, Description,Id")] Publisher publisher)
        {
            if (ModelState.IsValid)
            {
                await _publisherService.AddPublisherAsync(publisher);

                return(RedirectToAction(nameof(Index)));
            }

            return(View(publisher));
        }
Example #3
0
        public async Task <ActionResult> Post([FromBody] PublisherDto publisher)
        {
            try
            {
                await _publisherService.AddPublisherAsync(publisher).ConfigureAwait(true);
            }
            catch (ValidationException e)
            {
                return(ValidationProblem(new ValidationProblemDetails {
                    Detail = e.Message
                }));
            }

            return(Created(nameof(Get), null));
        }