Ejemplo n.º 1
0
 private static void MapCommonParameters(SquadMemberAddRequest model, SqlParameterCollection paramCollection)
 {
     paramCollection.AddWithValue("@SquadId", model.SquadId);
     paramCollection.AddWithValue("@PersonId", model.PersonId);
     paramCollection.AddWithValue("@LeaderComment", model.LeaderComment);
     paramCollection.AddWithValue("@UserIdCreated", UserService.GetCurrentUserId());
     paramCollection.AddWithValue("@MemberStatusId", model.MemberStatusId);
     paramCollection.AddWithValue("@IsLeader", model.IsLeader);
 }
Ejemplo n.º 2
0
        public HttpResponseMessage Add(SquadMemberAddRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState));
            }
            ItemResponse <int> response = new ItemResponse <int>();

            response.Item = SquadMemberService.Add(model);
            return(Request.CreateResponse(HttpStatusCode.OK, response));
        }
Ejemplo n.º 3
0
        public static int Add(SquadMemberAddRequest model)
        {
            int id = 0;

            DataProvider.ExecuteNonQuery(GetConnection, "dbo.SquadMember_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)
            {
                Int32.TryParse(param["@Id"].Value.ToString(), out id);
            }
                                         );

            return(id);
        }