public int AddMedicine(tblMedicine obj) { //obj.ID = 18; db.tblMedicines.Add(obj); db.SaveChanges(); return(obj.ID); }
public void UpdateMedicine(tblMedicine obj) { db.tblMedicines.Attach(obj); var update = db.Entry(obj); update.Property(x => x.Description).IsModified = true; update.Property(x => x.isActive).IsModified = true; update.Property(x => x.MedicineCategoryID).IsModified = true; update.Property(x => x.MedicineName).IsModified = true; db.SaveChanges(); }