public void SavePieceOfFurniture(PieceOfFurniture pieceoffurniture) { ICollection <ValidationResult> validationResults; if (!pieceoffurniture.Validate(out validationResults)) { var ex = new ValidationException("Objektet klarade inte valideringen."); ex.Data.Add("ValidationResults", validationResults); throw ex; } if (pieceoffurniture.PieceOfFurnitureID == 0) { PieceOfFurnitureDAL.InsertPieceOfFurniture(pieceoffurniture); } else { PieceOfFurnitureDAL.UpdatePieceOfFurniture(pieceoffurniture); } }
public IEnumerable <PieceOfFurniture> GetFurniture() { return(PieceOfFurnitureDAL.GetFurniture()); }
public PieceOfFurniture GetPieceOfFurniture(int pieceoffurnitureID) { return(PieceOfFurnitureDAL.GetPieceOfFurnitureById(pieceoffurnitureID)); }
public void DeletePieceOfFurniture(int pieceoffurnitureID) { PieceOfFurnitureDAL.DeletePieceOfFurniture(pieceoffurnitureID); }