public async Task <JsonResult> Add(string id) { if (id != null && id.Length > 5) { var publisher = new Publisher() { CreatedDate = DateTime.Now, LastUpdatedDate = DateTime.Now, PublisherName = id.ToUpper() }; var result = await PublisherService.AddAsync(publisher); var model = new BaseOperationModel() { isSuccess = result.isSuccess, Message = string.Join(";", result.Errors) }; return(Json(model)); } else { var model = new BaseOperationModel(); model.isSuccess = false; model.Message = "Yayınevi alanı en az 5 karaterden oluşmalıdır"; return(Json(model)); } }
public async Task <IActionResult> Post([FromBody] BLPublisher publisher) { if (publisher == null || publisher.Name.Length == 0) { return(BadRequest("Wrong game model")); } await _publisherService.AddAsync(publisher); return(Created(this.RouteData.ToString(), publisher)); }
protected override async Task <GetPublisherDto> ExecuteAsync(CreatePublisherCommand request, CancellationToken ct) { return(await _service.AddAsync(_mapper.Map <AddPublisherDto>(request), ct)); }