public override int AddNew(Customer obj) { using (EvenselPOSEntities context = new EvenselPOSEntities()) { context.AddToCustomers(obj); context.SaveChanges(); } return(1); }
/// <summary> /// Update Customer Details /// </summary> /// <param name="obj">New Customer Object</param> /// <returns>Return true if suceed else retrun false, If Customer Not Found Return null</returns> public override bool?Update(Customer obj) { using (EvenselPOSEntities context = new EvenselPOSEntities()) { //var query = from i in context.Customers // where i.ID == obj.ID // select i; //if (query != null) //{ context.AddToCustomers(obj); context.ObjectStateManager.ChangeObjectState(obj, System.Data.EntityState.Modified); return(IsChanged(context.SaveChanges())); //} //return null; } }