public void Destroy(LawyerViewModel db) { var entity = new Lawyer_Table(); entity.LawyerID = db.LawyerID; entities.Lawyer_Table.Attach(entity); entities.Lawyer_Table.Remove(entity); entities.SaveChanges(); }
public void Create(LawyerViewModel db) { var entity = new Lawyer_Table(); entity.LawyerName = db.LawyerName; entity.LawyerPhone = db.LawyerPhone; entity.LawyerAddress = db.LawyerAddress; entities.Lawyer_Table.Add(entity); entities.SaveChanges(); db.LawyerID = entity.LawyerID; }
public void Update(LawyerViewModel db) { var entity = new Lawyer_Table(); entity.LawyerID = db.LawyerID; entity.LawyerName = db.LawyerName; entity.LawyerPhone = db.LawyerPhone; entity.LawyerAddress = db.LawyerAddress; entities.Lawyer_Table.Attach(entity); entities.Entry(entity).State = EntityState.Modified; entities.SaveChanges(); }