public async Task <List <Timing> > Get()
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();
            var timings = mySoftCorporationDbContext.Timings.Include(t => t.User);

            return(await timings.ToListAsync());
        }
        public bool Update(VoucherType voucherType)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();

            mySoftCorporationDbContext.Entry(voucherType).State = EntityState.Modified;
            return(mySoftCorporationDbContext.SaveChanges() > 0);
        }
        public bool Delete(Province objectFirst)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();

            mySoftCorporationDbContext.Entry(objectFirst).State = EntityState.Deleted;
            return(mySoftCorporationDbContext.SaveChanges() > 0);
        }
 public List <Company> GetAll()
 {
     using (var context = new MySoftCorporationDbContext())
     {
         return(context.Companies.ToList());
     }
 }
 public Admission GetByID(int AdmissionID)
 {
     using (var mySoftCorporationDbContext = new MySoftCorporationDbContext())
     {
         return(mySoftCorporationDbContext.Admissions.Where(x => x.AdmissionID == AdmissionID).SingleOrDefault());
     }
 }
Пример #6
0
        public Student GetStudentByUserId(string UserID)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();
            var Students = mySoftCorporationDbContext.Students.AsQueryable();

            return(Students.Where(a => a.UserID.Contains(UserID)).SingleOrDefault());
        }
Пример #7
0
        public bool Update(Country objectFirst)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();

            mySoftCorporationDbContext.Entry(objectFirst).State = EntityState.Modified;
            return(mySoftCorporationDbContext.SaveChanges() > 0);
        }
        public bool Save(CourseCategory objectFirst)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();

            mySoftCorporationDbContext.CourseCategories.Add(objectFirst);
            return(mySoftCorporationDbContext.SaveChanges() > 0);
        }
 public Employee GetByID(int ID)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         return(context.Employees.FirstOrDefault(x => x.ID == ID));
     }
 }
        public bool Save(Province objectFirst)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();

            mySoftCorporationDbContext.Provinces.Add(objectFirst);
            return(mySoftCorporationDbContext.SaveChanges() > 0);
        }
Пример #11
0
        public bool SavePicture(Picture picture)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();

            mySoftCorporationDbContext.Pictures.Add(picture);
            return(mySoftCorporationDbContext.SaveChanges() > 0);
        }
 public VoucherType GetByID(int ID)
 {
     using (var mySoftCorporationDbContext = new MySoftCorporationDbContext())
     {
         return(mySoftCorporationDbContext.VoucherTypes.Find(ID));
     }
 }
Пример #13
0
 public Student GetByID(int ID)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         return(context.Students.Find(ID));
     }
 }
 public bool Delete(Employee employee)
 {
     using (var mySoftCorporationDbContext = new MySoftCorporationDbContext())
     {
         mySoftCorporationDbContext.Entry(employee).State = EntityState.Deleted;
         return(mySoftCorporationDbContext.SaveChanges() > 0);
     }
 }
 public (bool isSaved, string Error) Save(Employee employee)
 {
     using (var mySoftCorporationDbContext = new MySoftCorporationDbContext())
     {
         mySoftCorporationDbContext.Employees.Add(employee);
         return(mySoftCorporationDbContext.SaveChanges() > 0, "success");
     }
 }
 public bool Save(Company company)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         context.Companies.Add(company);
         return(context.SaveChanges() > 0);
     }
 }
Пример #17
0
 public (bool IsTrue, string Msg) ApproveAdmission(Admission admission)
 {
     using (var db = new MySoftCorporationDbContext())
     {
         db.Entry(admission).State = EntityState.Modified;
         return(db.SaveChanges() > 0, "Success");
     }
 }
 public bool Save(Timing timing)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         context.Timings.Add(timing);
         return(context.SaveChanges() > 0);
     }
 }
Пример #19
0
 public bool Save(Course course)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         context.Courses.Add(course);
         return(context.SaveChanges() > 0);
     }
 }
 public bool Save(VoucherType voucherType)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         context.VoucherTypes.Add(voucherType);
         return(context.SaveChanges() > 0);
     }
 }
        public IEnumerable <VoucherType> Search(string Search)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();
            var voucherTypes = mySoftCorporationDbContext.VoucherTypes.AsQueryable();

            voucherTypes = voucherTypes.Where(a => a.Name == Search);
            return(voucherTypes.AsEnumerable());
        }
Пример #22
0
 public bool Delete(Student objectFirst)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         context.Entry(objectFirst).State = EntityState.Deleted;
         return(context.SaveChanges() > 0);
     }
 }
Пример #23
0
 public bool Save(Student objectFirst)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         context.Students.Add(objectFirst);
         return(context.SaveChanges() > 0);
     }
 }
 public bool Update(Company company)
 {
     using (var newContext = new MySoftCorporationDbContext())
     {
         newContext.Entry(company).State = EntityState.Modified;
         return(newContext.SaveChanges() > 0);
     }
 }
 public bool Update(Timing timing)
 {
     using (var mySoftCorporationDbContext = new MySoftCorporationDbContext())
     {
         mySoftCorporationDbContext.Entry(timing).State = EntityState.Modified;
         return(mySoftCorporationDbContext.SaveChanges() > 0);
     }
 }
Пример #26
0
 public bool Delete(Course course)
 {
     using (var context = new MySoftCorporationDbContext())
     {
         context.Entry(course).State = EntityState.Deleted;
         return(context.SaveChanges() > 0);
     }
 }
 public Province GetByID(int ID)
 {
     using (MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext())
     {
         return(mySoftCorporationDbContext.Provinces.Find(ID));
         //return  mySoftCorporationDbContext.Provinces.Include(x => x.ID).SingleOrDefault(x => x.ID = ID);
     }
 }
        public Company GetByID(int ID)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();

            //using (mySoftCorporationDbContext)
            //{
            return(mySoftCorporationDbContext.Companies.Find(ID));
            //}
        }
        public bool Update(CourseCategory objectFirst)
        {
            var oldContext        = new MySoftCorporationDbContext();
            var oldCourseCategory = oldContext.CourseCategories.Find(objectFirst.ID);

            var NewContext = new MySoftCorporationDbContext();

            NewContext.Entry(objectFirst).State = EntityState.Modified;
            return(oldContext.SaveChanges() > 0);
        }
Пример #30
0
        public bool Update(Course course)
        {
            MySoftCorporationDbContext mySoftCorporationDbContext = new MySoftCorporationDbContext();
            var PreviousContext = mySoftCorporationDbContext.Courses.Find(course.ID);

            mySoftCorporationDbContext.CoursePictures.RemoveRange(PreviousContext.CoursePictures);
            mySoftCorporationDbContext.Entry(PreviousContext).CurrentValues.SetValues(course);
            mySoftCorporationDbContext.CoursePictures.AddRange(course.CoursePictures);
            return(mySoftCorporationDbContext.SaveChanges() > 0);
        }