public IHttpActionResult UpdateFAQ(UpdateFAQRequest updateFAQRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } var fAQ = new FAQ() { FAQId = updateFAQRequest.FAQId, CategoryId = updateFAQRequest.CategoryId, TopicName = updateFAQRequest.TopicName, PDF = updateFAQRequest.PDF, ModifiedBy = Utility.UserId }; int result = iFAQ.UpdateFAQ(fAQ); switch (result) { case 1: responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "FAQ updated successfully."; break; case -2: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "FAQ already exists."; break; case -3: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "FAQ doesn't exist."; break; default: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating FAQ."; break; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating FAQ."; Utility.WriteLog("UpdateFAQ", updateFAQRequest, "Error while updating FAQ. (FAQAdminController)", ex.ToString()); } return(Ok(responses)); }
public void Updatefaq() { BLModel.FAQAns = "tebcvbcsting tesing"; BLModel.FAQues = "testifdgdfgdfgng tesing"; BLModel.FAQCatID = 2; BLModel.FAQID = 3; int result = _faqBL.UpdateFAQ(BLModel); Assert.IsTrue(result > 0, "Unable to update"); }
public int UpdateFAQ(FAQ faq) { return(_faq.UpdateFAQ(Mapper.Map <DTO.FAQ, HCRGUniversity.Core.Data.Model.FAQ>(faq))); }