Esempio n. 1
0
        public HttpResponseMessage Add(JobTagAddRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
            }

            ItemResponse <int> response = new ItemResponse <int>();

            response.Item = _jobTagService.Insert(model);

            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Esempio n. 2
0
        public int Insert(JobTagAddRequest model)
        {
            int id = 0;

            DataProvider.ExecuteNonQuery(GetConnection, "dbo.JobTag_Insert",
                                         inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                MapCommonParameters(model, paramCollection);

                SqlParameter p = new SqlParameter("@Id", SqlDbType.Int);
                p.Direction    = ParameterDirection.Output;

                paramCollection.Add(p);
            }, returnParameters : delegate(SqlParameterCollection param)
            {
                int.TryParse(param["@Id"].Value.ToString(), out id);
            }
                                         );
            return(id);
        }
Esempio n. 3
0
 private static void MapCommonParameters(JobTagAddRequest model, SqlParameterCollection paramCollection)
 {
     paramCollection.AddWithValue("@Keyword", model.Keyword);
     paramCollection.AddWithValue("@DisplayOrder", model.DisplayOrder);
 }