public List <Anhs> EditAnh(User admin, Anhs lk) { if (admin.chucNang == "admin") { var anh = GetAnh(lk.maLinhKien); anh.maAnh = lk.MaAnh; anh.maLinhKien = lk.maLinhKien; anh.img = lk.Img; model.SaveChanges(); } return(GetListAnh(lk.maLinhKien)); }
public List <Anhs> AddLinhKien(User admin, Anhs lk) { if (admin.chucNang == "admin") { var anh = new Anh(); anh.maLinhKien = lk.maLinhKien; anh.img = lk.Img; model.Anhs.Add(anh); model.SaveChanges(); } return(GetListAnh(lk.maLinhKien)); }
public List <Anhs> GetListAnhs(string id = null) { List <Anhs> list = new List <Anhs>(); DataTable data; if (id == null) { data = DataProvider.Instance.ExecuteQuery("SELECT * FROM Anh"); } else { data = DataProvider.Instance.ExecuteQuery("SELECT * FROM Anh where maLinhKien=" + id); } foreach (DataRow item in data.Rows) { Anhs obj = new Anhs(item); list.Add(obj); } return(list); }