public async Task <IActionResult> Create(Publisher p) { var createPub = await _pub.AddAsync(p); if (createPub) { return(RedirectToAction("Index")); } return(View()); }
public async Task <IActionResult> AddPublisher([FromBody] Publisher publisher) { var createPublisher = await _publisher.AddAsync(publisher); if (createPublisher) { return(Ok("Publisher Created")); } else { return(BadRequest(new { message = "Unable to create Publisher details" })); } }
public async Task <IActionResult> Create(Publisher publisher) { publisher.CreatedBy = _userManager.GetUserName(User); var createPublisher = await _publisher.AddAsync(publisher); if (createPublisher) { Alert("Publisher created successfully!", NotificationType.success); return(RedirectToAction("Index")); } Alert("Publisher not deleted successfully!", NotificationType.error); return(View()); }
public async Task <IActionResult> AddPublisher([FromBody] Publisher p) { var NewPub = await _pub.AddAsync(p); if (NewPub) { return(Ok("New Publisher Added")); } else { return(BadRequest(new { message = "Unable to create Publisher details" })); } }
public async Task <IActionResult> Create(Publisher p) { var createPub = await _pub.AddAsync(p); if (createPub) { Alert("Publisher Created successfully.", NotificationType.success); return(RedirectToAction("Index")); } else { Alert("Publisher not Created!", NotificationType.error); } return(View()); }
public async Task <Response <PublisherModel> > Post([FromBody] PublisherModel model) { Response <PublisherModel> publisherResponseModel = new Response <PublisherModel>(); try { Publisher entity = _mapper.Map <Publisher>(model); entity = await(model.Id != Guid.Empty ? _publisher.UpdateAsync(entity) : _publisher.AddAsync(entity)); publisherResponseModel.Value = _mapper.Map <PublisherModel>(entity); publisherResponseModel.IsSuccess = true; } catch (Exception e) { publisherResponseModel.Exception = e; publisherResponseModel.IsSuccess = false; } return(publisherResponseModel); }