示例#1
0
 public void Update(int sectionId, SectionsUpdateRequest model)
 {
     DataProvider.ExecuteNonQuery(GetConnection, "dbo.Sections_Update_v2",
                                  inputParamMapper : delegate(SqlParameterCollection updateSection)
     {
         updateSection.AddWithValue("@Id", model.Id);
         updateSection.AddWithValue("@CourseId", model.CourseId);
         updateSection.AddWithValue("@DaysOfWeek", model.DaysOfWeek);
         updateSection.AddWithValue("@StartDate", model.StartDate);
         updateSection.AddWithValue("@EndDate", model.EndDate);
         updateSection.AddWithValue("@RegistrationDeadline", model.RegistrationDeadline);
         updateSection.AddWithValue("@StartTime", model.StartTime);
         updateSection.AddWithValue("@EndTime", model.EndTime);
         updateSection.AddWithValue("@TimeZone", model.TimeZone);
         //updateSection.AddWithValue("@Info", model.Info);
         updateSection.AddWithValue("@Format", model.Format);
         //updateSection.AddWithValue("@CampusLocation", model.CampusLocation);
         //updateSection.AddWithValue("@RoomNumber", model.RoomNumber);
         updateSection.AddWithValue("@Capacity", model.Capacity);
         //updateSection.AddWithValue("@CurrentEnrollment", model.CurrentEnrollment);
         updateSection.AddWithValue("@Status", model.Status);
     });
     //DataProvider.ExecuteNonQuery(GetConnection, "dbo.SectionInstructors_DeleteBySectionId",
     //    inputParamMapper: delegate (SqlParameterCollection parameterCollection)
     //    {
     //        parameterCollection.AddWithValue("@SectionId", model.Id);
     //    });
     //foreach (var InstructorId in model.Instructors)
     //    DataProvider.ExecuteNonQuery(GetConnection, "dbo.SectionInstructors_InsertV2",
     //        inputParamMapper: delegate (SqlParameterCollection param)
     //        {
     //            param.AddWithValue("@SectionId", model.Id);
     //            param.AddWithValue("@InstructorId", InstructorId);
     //        });
 }
        public HttpResponseMessage Update(int sectionId, SectionsUpdateRequest model)
        {
            if (!ModelState.IsValid)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
            }

            SucessResponse response = new SucessResponse();

            _sectionService.Update(sectionId, model);

            return(Request.CreateResponse(response));
        }