public void Addfaq() { BLModel.FAQAns = "testing tesing"; BLModel.FAQues = "testing tesing"; BLModel.FAQCatID = 2; int result = _faqBL.AddFAQ(BLModel); Assert.IsTrue(result > 0, "Unable to Add"); }
public IHttpActionResult AddFAQ(AddFAQRequest addFAQRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var fAQ = new FAQ() { CategoryId = addFAQRequest.CategoryId, TopicName = addFAQRequest.TopicName, PDF = addFAQRequest.PDF, CreatedBy = Utility.UserId }; int result = iFAQ.AddFAQ(fAQ); if (result > 0) { responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "FAQ added successfully."; } else if (result == -2) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "FAQ alread exists."; } else { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding FAQ."; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding FAQ."; Utility.WriteLog("AddFAQ", addFAQRequest, "Error while adding FAQ. (FAQAdminController)", ex.ToString()); } return(Ok(responses)); }
public int AddFAQ(FAQ faq) { return(_faq.AddFAQ(Mapper.Map <DTO.FAQ, HCRGUniversity.Core.Data.Model.FAQ>(faq))); }