public bool addFilmLike(String ms_thanhVien, int ms_phim) { try { DanhSachPhimYeuThich check = db.DanhSachPhimYeuThich.Where( e => e.MS_ThanhVien == ms_thanhVien && e.MS_Phim == ms_phim && e.TinhTrang == false).FirstOrDefault(); if (check != null) { check.TinhTrang = true; check.ThoiGian = System.DateTime.Now; db.SaveChanges(); return true; } else { DanhSachPhimYeuThich ds = new DanhSachPhimYeuThich(); ds.MS_Phim = ms_phim; ds.MS_ThanhVien = ms_thanhVien; ds.TinhTrang = true; ds.ThoiGian = System.DateTime.Now; db.DanhSachPhimYeuThich.Add(ds); db.SaveChanges(); return true; } } catch (Exception e) { return false; } }
public bool addFilmLike(String ms_thanhVien, int ms_phim) { try { DanhSachPhimYeuThich check = db.DanhSachPhimYeuThich.Where( e => e.MS_ThanhVien == ms_thanhVien && e.MS_Phim == ms_phim && e.TinhTrang == false).FirstOrDefault(); if (check != null) { check.TinhTrang = true; check.ThoiGian = System.DateTime.Now; db.SaveChanges(); return(true); } else { DanhSachPhimYeuThich ds = new DanhSachPhimYeuThich(); ds.MS_Phim = ms_phim; ds.MS_ThanhVien = ms_thanhVien; ds.TinhTrang = true; ds.ThoiGian = System.DateTime.Now; db.DanhSachPhimYeuThich.Add(ds); db.SaveChanges(); return(true); } } catch (Exception e) { return(false); } }
public bool checkList(string username, int ms_phim) { AspNetUsers user = db.AspNetUsers.SingleOrDefault(e => e.UserName == username); if (user == null) { return(false); } try { DanhSachPhimYeuThich ds = db.DanhSachPhimYeuThich.Where( e => e.MS_ThanhVien == user.Id && e.MS_Phim == ms_phim && e.TinhTrang == true).FirstOrDefault(); if (ds != null) { return(true); } else { return(false); } } catch (Exception e) { return(false); } }
public FilmLikeModels DanhSachPhimYeuThich2DanhSachPhimYeuThichFilmModel(DanhSachPhimYeuThich p) { FilmLikeModels result = new FilmLikeModels(); result.MaSo = p.MaSo; result.ms_thanhVien = p.MS_ThanhVien; int temp = (int)p.MS_Phim; result.ms_phim = temp; return result; }
public bool deleteFilm(string userId, int IDFilm) { try { DanhSachPhimYeuThich temp = db.DanhSachPhimYeuThich.Where(x => x.MS_ThanhVien == userId && x.MS_Phim == IDFilm).FirstOrDefault(); temp.TinhTrang = false; db.SaveChanges(); return(true); } catch (Exception e) { return(false); } }