Exemplo n.º 1
0
    public void Update(FAQsUpdateRequest model, string userId, int Id)
    {
        int id = 0;

        DataProvider.ExecuteNonQuery(GetConnection, "dbo.FAQs_Update"
                                     , inputParamMapper : delegate(SqlParameterCollection paramCollection)
        {
            SqlParameter ids = new SqlParameter("@CatList", System.Data.SqlDbType.Structured);

            if (model.Categories != null && model.Categories.Any())
            {
                ids.Value = new object.Data.IntIdTable(model.Categories);
            }

            paramCollection.Add(ids);

            paramCollection.AddWithValue("@Id", Id);
            paramCollection.AddWithValue("@Question", model.Question);;
            paramCollection.AddWithValue("@DisplayOrder", model.DisplayOrder);
            paramCollection.AddWithValue("@ModifiedBy", userId);
            paramCollection.AddWithValue("@Answer", model.Answer);
        }, returnParameters : delegate(SqlParameterCollection param)
        {
            int.TryParse(param["@Id"].Value.ToString(), out id);
        }
                                     );
    }
Exemplo n.º 2
0
        public HttpResponseMessage UpdateFAQs(FAQsUpdateRequest model, int id)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
            }
            string userId = _userService.GetCurrentUserId();

            _faqsService.Update(model, userId, id);

            SuccessResponse response = new SuccessResponse();

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }