public JsonResult GetStudentList() { using (MusicStoreDataContext dbContext = new MusicStoreDataContext()) { List <Student> studentList = dbContext.Student.ToList(); var x = Json(studentList, JsonRequestBehavior.AllowGet); return(x); } }
public JsonResult AddStudent(Student student) { if (student != null) { using (MusicStoreDataContext dbContext = new MusicStoreDataContext()) { dbContext.Student.Add(student); dbContext.SaveChanges(); return(Json(student, JsonRequestBehavior.AllowGet)); } } else { return(Json("Some Error Occured")); } }
public string DeleteStudent(int Id) { if (Id != 0) { using (MusicStoreDataContext dataContext = new MusicStoreDataContext()) { // int id = Convert.ToInt32(Id); var lstStud = dataContext.Student.Where(x => x.ID == Id).FirstOrDefault(); dataContext.Student.Remove(lstStud); dataContext.SaveChanges(); return("Student has been deleted succhessfully."); } } else { return(" Oops! Error occered."); } }
public string UpdateStudent(Student stu) { if (stu != null) { using (MusicStoreDataContext dbContext = new MusicStoreDataContext()) { Student lstStudent = dbContext.Student.Where(x => x.ID == stu.ID).FirstOrDefault(); lstStudent.StudentName = stu.StudentName; lstStudent.StudentAddress = stu.StudentAddress; lstStudent.StudentEmail = stu.StudentEmail; dbContext.SaveChanges(); return("Student Updated"); } } else { return("Oops! something went wrong."); } }
public Repository(MusicStoreDataContext context) { this.context = context; }
public Repository() { context = new MusicStoreDataContext(); DbSet = context.Set <T>(); }
public Repositery(MusicStoreDataContext context) { _context = context; }
public AddToCartCmd(MusicStoreDataContext dbContext) { _dbContext = dbContext; }
public DropListServiceQry(MusicStoreDataContext dbContext) { _dbContext = dbContext; }
public CartQuery(MusicStoreDataContext dbContext) { _dbContext = dbContext; }
public AlbumCmd(MusicStoreDataContext dbContext) { _dbContext = dbContext; }
public StoreQry(MusicStoreDataContext dbContext) { _dbContext = dbContext; }
public UserValidateQry(MusicStoreDataContext dbContext) { _dbContext = dbContext; }
public SubmitOrderCmd(MusicStoreDataContext dbContext, ICartService cartService) { _dbContext = dbContext; _cartService = cartService; }
public RegisterUserCmd(MusicStoreDataContext dbContext) { _dbContext = dbContext; }