Esempio n. 1
0
        public IHttpActionResult PutClass(long id, Class @class)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != @class.PKClassId)
            {
                return(BadRequest());
            }

            db.Entry(@class).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClassExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 2
0
        public IHttpActionResult PutUserVideo(long id, UserVideo userVideo)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != userVideo.PKUserVideoId)
            {
                return(BadRequest());
            }

            db.Entry(userVideo).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!UserVideoExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutAvailableTeacherTime(long id, AvailableTeacherTime availableTeacherTime)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != availableTeacherTime.PKAvailableTeacherTimeId)
            {
                return(BadRequest());
            }

            db.Entry(availableTeacherTime).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!AvailableTeacherTimeExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
        public IHttpActionResult PutTeacherProfile(long id, TeacherProfile teacherProfile)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != teacherProfile.PKTeachersId)
            {
                return(BadRequest());
            }

            db.Entry(teacherProfile).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!TeacherProfileExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 5
0
        public IHttpActionResult PutSubject(long id, Subject subject)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != subject.PKSubjectId)
            {
                return(BadRequest());
            }

            db.Entry(subject).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!SubjectExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Esempio n. 6
0
        public static void InsertUserEnquiry(UserEnquiry objUserEnquiry)
        {
            TeachersEntities db = new TeachersEntities();

            db.UserEnquiries.Add(objUserEnquiry);
            db.SaveChanges();
        }
Esempio n. 7
0
        public static void UpdateLoginHistory(LoginHistory objLoginHistory)
        {
            TeachersEntities db = new TeachersEntities();

            db.Entry(objLoginHistory).State = EntityState.Modified;
            db.SaveChanges();
        }
Esempio n. 8
0
        public static void InsertLoginHistory(LoginHistory objLoginHistory)
        {
            TeachersEntities db = new TeachersEntities();

            db.LoginHistories.Add(objLoginHistory);
            db.SaveChanges();
        }
Esempio n. 9
0
        public static void InsertUserImages(UserImage objUserImage)
        {
            TeachersEntities db = new TeachersEntities();

            db.UserImages.Add(objUserImage);
            db.SaveChanges();
        }
Esempio n. 10
0
        public static void UpdateUserVideo(UserVideo userVideo)
        {
            TeachersEntities db = new TeachersEntities();

            db.Entry(userVideo).State = EntityState.Modified;
            db.SaveChanges();
        }
Esempio n. 11
0
        public static void UpdateUserEnquiry(UserEnquiry objUserEnquiry)
        {
            TeachersEntities db = new TeachersEntities();

            db.Entry(objUserEnquiry).State = EntityState.Modified;
            db.SaveChanges();
        }
Esempio n. 12
0
        public static void InsertUserVideo(UserVideo userVideo)
        {
            TeachersEntities db = new TeachersEntities();

            db.UserVideos.Add(userVideo);
            db.SaveChanges();
        }
Esempio n. 13
0
 public static void InsertCity(City objCity)
 {
     using (TeachersEntities db = new TeachersEntities())
     {
         db.Cities.Add(objCity);
         db.SaveChanges();
     }
 }
Esempio n. 14
0
        public static void DeleteUserVideo(long id)
        {
            TeachersEntities db        = new TeachersEntities();
            UserVideo        userVideo = db.UserVideos.Find(id);

            db.UserVideos.Remove(userVideo);
            db.SaveChanges();
        }
Esempio n. 15
0
        public static void DeleteUserImages(int userImageId)
        {
            TeachersEntities db           = new TeachersEntities();
            UserImage        objUserImage = db.UserImages.Find(userImageId);

            db.UserImages.Remove(objUserImage);
            db.SaveChanges();
        }
Esempio n. 16
0
        public static void DeleteLoginHistory(int loginHistoryId)
        {
            TeachersEntities db = new TeachersEntities();
            LoginHistory     objLoginHistory = db.LoginHistories.Find(loginHistoryId);

            db.LoginHistories.Remove(objLoginHistory);
            db.SaveChanges();
        }
Esempio n. 17
0
        public static void InsertUsers(UserProfile objUser)
        {
            TeachersEntities db = new TeachersEntities();

            db.UserProfiles.Add(objUser);
            db.SaveChanges();
            cache.Remove("UserProfile");
        }
Esempio n. 18
0
 public static void UpdateCity(City objCity)
 {
     using (TeachersEntities db = new TeachersEntities())
     {
         db.Entry(objCity).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Esempio n. 19
0
        public static void InsertAvailableTeacherTime(AvailableTeacherTime objAvailableTeacherTime)
        {
            TeachersEntities db = new TeachersEntities();

            db.AvailableTeacherTimes.Add(objAvailableTeacherTime);
            db.SaveChanges();
            cache.Remove("GetTeachersHome");
        }
Esempio n. 20
0
        public static void DeleteUserEnquiry(int userEnquiryId)
        {
            TeachersEntities db             = new TeachersEntities();
            UserEnquiry      objUserEnquiry = db.UserEnquiries.Find(userEnquiryId);

            db.UserEnquiries.Remove(objUserEnquiry);
            db.SaveChanges();
        }
Esempio n. 21
0
        public static void UpdateUsers(UserProfile objuser)
        {
            TeachersEntities db = new TeachersEntities();

            db.Entry(objuser).State = EntityState.Modified;
            db.SaveChanges();
            cache.Remove("UserProfile");
        }
Esempio n. 22
0
 public static void AddUserComments(UserComment userComments)
 {
     using (TeachersEntities db = new TeachersEntities())
     {
         db.UserComments.Add(userComments);
         db.SaveChanges();
     }
 }
Esempio n. 23
0
        public static void InsertTeacherProfile(TeacherProfile objTeacherProfile)
        {
            TeachersEntities db = new TeachersEntities();

            db.TeacherProfiles.Add(objTeacherProfile);
            db.SaveChanges();
            cache.Remove("GetTeachersHome");
        }
Esempio n. 24
0
        public static void DeleteAvailableTeacherTime(long availableTeacherTimeId)
        {
            TeachersEntities     db = new TeachersEntities();
            AvailableTeacherTime objAvailableTeacherTime = db.AvailableTeacherTimes.Find(availableTeacherTimeId);

            db.AvailableTeacherTimes.Remove(objAvailableTeacherTime);
            db.SaveChanges();
            cache.Remove("GetTeachersHome");
        }
Esempio n. 25
0
 public static void InsertSubject(Subject objSubject)
 {
     using (TeachersEntities db = new TeachersEntities())
     {
         db.Subjects.Add(objSubject);
         db.SaveChanges();
     }
     cache.Remove("GetSubjects");
 }
Esempio n. 26
0
 public static void UpdateSubject(Subject objSubject)
 {
     using (TeachersEntities db = new TeachersEntities())
     {
         db.Entry(objSubject).State = EntityState.Modified;
         db.SaveChanges();
     }
     cache.Remove("GetSubjects");
 }
Esempio n. 27
0
        public static void DeleteUsers(int userId)
        {
            TeachersEntities db      = new TeachersEntities();
            UserProfile      objUser = db.UserProfiles.Find(userId);

            db.UserProfiles.Remove(objUser);
            db.SaveChanges();
            cache.Remove("UserProfile");
        }
Esempio n. 28
0
 public static void UpdateState(State objState)
 {
     using (TeachersEntities db = new TeachersEntities())
     {
         db.Entry(objState).State = EntityState.Modified;
         db.SaveChanges();
         cache.Remove("GetStates");
     }
 }
Esempio n. 29
0
 public static void InsertState(State objState)
 {
     using (TeachersEntities db = new TeachersEntities())
     {
         db.States.Add(objState);
         db.SaveChanges();
         cache.Remove("GetStates");
     }
 }
Esempio n. 30
0
 public static void DeleteCity(long cityId)
 {
     using (TeachersEntities db = new TeachersEntities())
     {
         City objCity = db.Cities.Find(cityId);
         db.Cities.Remove(objCity);
         db.SaveChanges();
     }
 }