public bool UpdateProduct(PRODUCT entity, int id) { try// su ly ngoai le { var update = db.PRODUCTs.Find(id); update.productName = entity.productName; update.product_Code = entity.product_Code; update.productQuantity = entity.productQuantity; update.product_Desc = entity.product_Desc; update.price = entity.price; update.types = entity.types; update.brandId = entity.brandId; update.catId = entity.catId; update.images = entity.images; db.Entry(update).State = EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool UpdateCategory(CATEGORY entity, int id) { try// su ly ngoai le { var update = db.CATEGORies.Find(id); update.catName = entity.catName; db.Entry(update).State = EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool UpdateBrand(BRAND entity, int id) { try// su ly ngoai le { var update = db.BRANDs.Find(id); update.brandName = entity.brandName; update.topBrand = entity.topBrand; db.Entry(update).State = EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool Changepassword(string userName, string PassWord, string newPassWord) { var result = db.ADMINs.Count(x => x.adminUser == userName && x.adminPass == PassWord); if (result > 0) { var update = db.ADMINs.SingleOrDefault(x => x.adminUser == userName && x.adminPass == PassWord); update.adminPass = newPassWord; db.Entry(update).State = EntityState.Modified; db.SaveChanges(); return(true); } else { return(false); } }
public bool UpdateSlider(SLIDER entity, int id) { try// su ly ngoai le { var update = db.SLIDERs.Find(id); update.sliderName = entity.sliderName; update.slider_Image = entity.slider_Image; update.type0 = entity.type0; db.Entry(update).State = EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }
public bool UpdateNews(NEWS entity, int id) { try// su ly ngoai le { var update = db.NEWS.Find(id); update.newsTitle = entity.newsTitle; update.newsImg = entity.newsImg; update.newsContent = entity.newsContent; update.newsType = entity.newsType; db.Entry(update).State = EntityState.Modified; db.SaveChanges(); return(true); } catch (Exception ex) { return(false); } }