public async Task <ActionResult> Post([FromBody] CreateFaqQuestionViewModel viewModel) { if (viewModel == null) { return(this.BadRequest()); } var faqQuestion = this.mapper.Map <CreateFaqQuestionViewModel, FaqQuestion>(viewModel); this.unitOfWorks.FaqQuestionRepositiry.Create(faqQuestion); await this.unitOfWorks.SaveAsync(); return(this.Ok()); }
public async Task <ActionResult> Put(int id, [FromBody] CreateFaqQuestionViewModel viewModel) { var faqQuestion = this.unitOfWorks.FaqQuestionRepositiry.Get(id); if (faqQuestion == null) { return(this.NotFound()); } this.mapper.Map <CreateFaqQuestionViewModel, FaqQuestion>(viewModel, faqQuestion); this.unitOfWorks.FaqQuestionRepositiry.Update(faqQuestion); await this.unitOfWorks.SaveAsync(); return(this.Ok()); }