Ejemplo n.º 1
0
 // PUT api/values/5
 public HttpResponseMessage Put(int id, Section sectionDetails)
 {
     try
     {
         var section = new DataEntities.Models.Section();
         if (sectionDetails != null)
         {
             section.SectionID    = sectionDetails.SectionID;
             section.YearLvl      = sectionDetails.YearLvl;
             section.SectionName  = sectionDetails.SectionName;
             section.CurriculumID = sectionDetails.CurriculumID;
             section.MaxGrade     = sectionDetails.MaxGrade;
             section.MaxStudent   = sectionDetails.MaxStudent;
             section.MinGrade     = sectionDetails.MinGrade;
             section.SchoolID     = sectionDetails.SchoolID;
         }
         unitOfWork.SectionRepository.Insert(section);
         unitOfWork.Save();
         return(Request.CreateResponse <Section>(HttpStatusCode.OK, section));
     }
     catch
     {
         return(Request.CreateResponse <Section>(HttpStatusCode.NotFound, null));
     }
 }
Ejemplo n.º 2
0
        // POST api/values
        public HttpResponseMessage Post(int id, DataEntities.Models.Section sectionDetails)
        {
            var section = unitOfWork.SectionRepository.GetByID(id);

            section.SectionID    = sectionDetails.SectionID;
            section.YearLvl      = sectionDetails.YearLvl;
            section.SectionName  = sectionDetails.SectionName;
            section.CurriculumID = sectionDetails.CurriculumID;
            section.MaxGrade     = sectionDetails.MaxGrade;
            section.MaxStudent   = sectionDetails.MaxStudent;
            section.MinGrade     = sectionDetails.MinGrade;
            section.SchoolID     = sectionDetails.SchoolID;
            unitOfWork.SectionRepository.Update(section);
            unitOfWork.Save();
            return(Request.CreateResponse <Section>(HttpStatusCode.OK, section));
        }
Ejemplo n.º 3
0
        // GET api/values/5
        public HttpResponseMessage Get(int id)
        {
            var sectionDetails = unitOfWork.SectionRepository.GetByID(id);
            var section        = new DataEntities.Models.Section();

            if (sectionDetails != null)
            {
                section.SectionID    = sectionDetails.SectionID;
                section.YearLvl      = sectionDetails.YearLvl;
                section.SectionName  = sectionDetails.SectionName;
                section.CurriculumID = sectionDetails.CurriculumID;
                section.MaxGrade     = sectionDetails.MaxGrade;
                section.MaxStudent   = sectionDetails.MaxStudent;
                section.MinGrade     = sectionDetails.MinGrade;
                section.SchoolID     = sectionDetails.SchoolID;
            }
            return(Request.CreateResponse <Section>(HttpStatusCode.OK, section));
        }