Пример #1
0
        public static void Put(int Id, EventsUpdateRequest model)
        {
            DataProvider.ExecuteNonQuery(GetConnection, "dbo.Events_Update"
                                         , inputParamMapper : delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@Id", model.Id);
                paramCollection.AddWithValue("@UserId", model.UserId);
                paramCollection.AddWithValue("@Title", model.Title);
                paramCollection.AddWithValue("@Description", model.Description);
                paramCollection.AddWithValue("@Start", model.Start);
                paramCollection.AddWithValue("@End", model.End);
                paramCollection.AddWithValue("@EventType", model.EventType);
                paramCollection.AddWithValue("@IsPublic", model.IsPublic);

                // adding new parameter
                SqlParameter s = new SqlParameter("@TagsId", SqlDbType.Structured);
                if (model.Tags != null && model.Tags.Any())
                {
                    s.Value = new IntIdTable(model.Tags);
                }
                paramCollection.Add(s);
            }, returnParameters : delegate(SqlParameterCollection param)
            {
            }
                                         );
        }
Пример #2
0
        public HttpResponseMessage Update(EventsUpdateRequest model, int Id)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            SucessResponse response = new SucessResponse();

            EventsService.Update(model);
            return(Request.CreateResponse(response));
        }
Пример #3
0
        public HttpResponseMessage Put(int Id, EventsUpdateRequest model)
        {
            if (model == null)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Request payload was null"));
            }
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }
            //model.UserId = UserService.GetCurrentUserId();

            EventsService.Put(Id, model);

            return(Request.CreateResponse(HttpStatusCode.OK, model));
        }
Пример #4
0
 public static void Put(int Id, EventsUpdateRequest model)
 {
     DataProvider.ExecuteNonQuery(GetConnection, "dbo.Events_Update"
                                  , inputParamMapper : delegate(SqlParameterCollection paramCollection)
     {
         paramCollection.AddWithValue("@Id", model.Id);
         paramCollection.AddWithValue("@EventType", model.EventType);
         paramCollection.AddWithValue("@IsPublic", model.IsPublic);
         paramCollection.AddWithValue("@Title", model.Title);
         paramCollection.AddWithValue("@Description", model.Description);
         paramCollection.AddWithValue("@Start", model.Start);
         paramCollection.AddWithValue("@Duration", model.Duration);
         paramCollection.AddWithValue("@MediaId", model.MediaId);
         paramCollection.AddWithValue("@NumberAttendees", model.NumberAttendees);
     }, returnParameters : delegate(SqlParameterCollection param)
     {
     }
                                  );
 }