public bool Update(User Entity, out string state) { if (EntityValidation.ValidateUserEntity(Entity, out state)) { db.Entry(db.Users.Find(Entity.UserID)).CurrentValues.SetValues(Entity); bool sonuc = db.SaveChanges() > 1; if (sonuc) { state = "User updated successfully"; return(true); } else { return(false); } } else { return(false); } }
public bool Delete(User Entity, out string state) { if (EntityValidation.ValidateUserEntity(Entity, out state)) { Entity.IsDeleted = true; bool sonuc = db.SaveChanges() > 1; if (sonuc) { state = "User deleted successfully"; return(true); } else { return(false); } } else { return(false); } }
public bool Insert(User Entity, out string state) { if (EntityValidation.ValidateUserEntity(Entity, out state)) { db.Users.Add(Entity); bool sonuc = db.SaveChanges() > 0; if (sonuc) { state = "User added successfully"; return(true); } else { state = "There was a problem adding user to db"; return(false); } } else { return(false); } }