public IEnumerable <AuthorFAQQuestionReply> GetAuthorFAQQuestionReply(AuthorFAQQuestionReply authorFAQQuestionReply) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter totalPageCount = new ObjectParameter("TotalPageCount", typeof(int)); ObjectParameter totalRecord = new ObjectParameter("TotalRecord", typeof(int)); var authorFAQQuestionReplys = dataContext.AuthorFAQQuestionReplyGet(authorFAQQuestionReply.AuthorFAQQuestionReplyId, authorFAQQuestionReply.AuthorFAQDetailId, Utility.TrimString(authorFAQQuestionReply.SearchText), authorFAQQuestionReply.IsActive, authorFAQQuestionReply.PageNumber, authorFAQQuestionReply.PageSize, authorFAQQuestionReply.IsPagingRequired, Utility.TrimString(authorFAQQuestionReply.OrderBy), Utility.TrimString(authorFAQQuestionReply.OrderByDirection), totalPageCount, totalRecord).ToList(); var authorFAQQuestionReplyList = new List <AuthorFAQQuestionReply>(); foreach (var authorFAQQuestionReplyDetail in authorFAQQuestionReplys) { authorFAQQuestionReplyList.Add(new AuthorFAQQuestionReply() { AuthorFAQQuestionReplyId = authorFAQQuestionReplyDetail.AuthorFAQQuestionReplyId, AuthorFAQDetailId = authorFAQQuestionReplyDetail.AuthorFAQDetailId, Question = authorFAQQuestionReplyDetail.Question, Reply = authorFAQQuestionReplyDetail.Reply, IsActive = authorFAQQuestionReplyDetail.IsActive, TotalPageCount = Convert.ToInt32(totalPageCount.Value), TotalRecord = Convert.ToInt32(totalRecord.Value) }); } return(authorFAQQuestionReplyList); } }
public IHttpActionResult UpdateAuthorFAQQuestionReply(UpdateAuthorFAQQuestionReplyRequest updateAuthorFAQQuestionReplyRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } var authorFAQQuestionReply = new AuthorFAQQuestionReply() { AuthorFAQQuestionReplyId = updateAuthorFAQQuestionReplyRequest.AuthorFAQQuestionReplyId, AuthorFAQDetailId = updateAuthorFAQQuestionReplyRequest.AuthorFAQDetailId, Question = updateAuthorFAQQuestionReplyRequest.Question, Reply = updateAuthorFAQQuestionReplyRequest.Reply, ModifiedBy = Utility.UserId }; int result = iAuthorFAQQuestionReply.UpdateAuthorFAQQuestionReply(authorFAQQuestionReply); switch (result) { case 1: responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "AuthorFAQQuestionReply updated successfully."; break; case -2: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "AuthorFAQQuestionReply already exists."; break; case -3: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "AuthorFAQQuestionReply doesn't exist."; break; default: responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating authorfaqquestionreply."; break; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while updating admin profile."; Utility.WriteLog("UpdateAuthorFAQQuestionReply", updateAuthorFAQQuestionReplyRequest, "Error while updating authorfaqquestionreply. (AuthorFAQQuestionReplyAdminController)", ex.ToString()); } return(Ok(responses)); }
public int DeleteAuthorFAQQuestionReply(AuthorFAQQuestionReply authorFAQQuestionReply) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter result = new ObjectParameter("Result", typeof(int)); dataContext.AuthorFAQQuestionReplyDelete(authorFAQQuestionReply.AuthorFAQQuestionReplyId, authorFAQQuestionReply.ModifiedBy, result); return(Convert.ToInt32(result.Value)); } }
public int UpdateAuthorFAQQuestionReply(AuthorFAQQuestionReply authorFAQQuestionReply) { using (DemsifyEntities dataContext = new DemsifyEntities()) { ObjectParameter result = new ObjectParameter("Result", typeof(int)); dataContext.AuthorFAQQuestionReplyUpdate(authorFAQQuestionReply.AuthorFAQQuestionReplyId, authorFAQQuestionReply.AuthorFAQDetailId, Utility.TrimString(authorFAQQuestionReply.Question), Utility.TrimString(authorFAQQuestionReply.Reply), authorFAQQuestionReply.ModifiedBy, result); return(Convert.ToInt32(result.Value)); } }
public IHttpActionResult AddAuthorFAQQuestionReply(AddAuthorFAQQuestionReplyRequest addAuthorFAQQuestionReplyRequest) { var responses = new Responses(); try { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var authorFAQQuestionReply = new AuthorFAQQuestionReply() { AuthorFAQDetailId = addAuthorFAQQuestionReplyRequest.AuthorFAQDetailId, Question = addAuthorFAQQuestionReplyRequest.Question, Reply = addAuthorFAQQuestionReplyRequest.Reply, CreatedBy = Utility.UserId }; int result = iAuthorFAQQuestionReply.AddAuthorFAQQuestionReply(authorFAQQuestionReply); if (result > 0) { responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "AuthorFAQQuestionReply added successfully."; } else if (result == -2) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "AuthorFAQQuestionReply alread exists."; } else { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding authorfaqquestionreply."; } } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while adding authorfaqquestionreply."; Utility.WriteLog("AddAuthorFAQQuestionReply", addAuthorFAQQuestionReplyRequest, "Error while adding authorfaqquestionreply. (AuthorFAQQuestionReplyAdminController)", ex.ToString()); } return(Ok(responses)); }
public IHttpActionResult GetAuthorFAQQuestionReply([FromUri] GetAuthorFAQQuestionReplyRequest getAuthorFAQQuestionReplyRequest) { var responses = new Responses(); try { if (Utility.UserId < 0) { return(BadRequest(Utility.INVALID_USER)); } if (getAuthorFAQQuestionReplyRequest == null) { getAuthorFAQQuestionReplyRequest = new GetAuthorFAQQuestionReplyRequest(); } if (getAuthorFAQQuestionReplyRequest.PageSize == null) { getAuthorFAQQuestionReplyRequest.PageSize = Convert.ToInt32(ConfigurationManager.AppSettings["PageSize"]); } var authorFAQQuestionReply = new AuthorFAQQuestionReply() { AuthorFAQQuestionReplyId = getAuthorFAQQuestionReplyRequest.AuthorFAQQuestionReplyId, AuthorFAQDetailId = getAuthorFAQQuestionReplyRequest.AuthorFAQDetailId, SearchText = getAuthorFAQQuestionReplyRequest.SearchText, IsActive = getAuthorFAQQuestionReplyRequest.IsActive, PageNumber = getAuthorFAQQuestionReplyRequest.PageNumber, PageSize = Convert.ToInt32(getAuthorFAQQuestionReplyRequest.PageSize), IsPagingRequired = (getAuthorFAQQuestionReplyRequest.PageNumber != null) ? true : false, OrderBy = getAuthorFAQQuestionReplyRequest.OrderBy, OrderByDirection = getAuthorFAQQuestionReplyRequest.OrderByDirection }; var authorFAQQuestionReplys = iAuthorFAQQuestionReply.GetAuthorFAQQuestionReply(authorFAQQuestionReply); var authorFAQQuestionReplyList = new List <GetAuthorFAQQuestionReplyResponse>(); foreach (var authorFAQQuestionReplyDetail in authorFAQQuestionReplys) { authorFAQQuestionReplyList.Add(new GetAuthorFAQQuestionReplyResponse() { AuthorFAQQuestionReplyId = Convert.ToInt32(authorFAQQuestionReplyDetail.AuthorFAQQuestionReplyId), AuthorFAQDetailId = Convert.ToInt32(authorFAQQuestionReplyDetail.AuthorFAQDetailId), Question = authorFAQQuestionReplyDetail.Question, Reply = authorFAQQuestionReplyDetail.Reply, IsActive = Convert.ToBoolean(authorFAQQuestionReplyDetail.IsActive), CreatedBy = authorFAQQuestionReplyDetail.CreatedBy, TotalPageCount = authorFAQQuestionReplyDetail.TotalPageCount, TotalRecord = authorFAQQuestionReplyDetail.TotalRecord }); } responses.Status = Utility.SUCCESS_STATUS_RESPONSE; responses.Description = "AuthorFAQQuestionReply retrieved successfully"; responses.Response = authorFAQQuestionReplyList; } catch (Exception ex) { responses.Status = Utility.ERROR_STATUS_RESPONSE; responses.Description = "Error while retrieving authorfaqquestionreply."; Utility.WriteLog("GetAuthorFAQQuestionReply", getAuthorFAQQuestionReplyRequest, "Error while retrieving authorfaqquestionreply. (AuthorFAQQuestionReplyAdminController)", ex.ToString()); } return(Ok(responses)); }