public object Get(GetCafeByZipRequest request) { DbCafe dbCafe = new DbCafe(); if (request.Zip.Length <= 4) { return(new CafeResponse { Result = dbCafe.GetAllCafesByZip(request.Zip) }); } else { return(new CafeResponse { Result = dbCafe.GetAllCafes() }); } }
public object Get(CafeRequest request) { DbCafe dbCafe = new DbCafe(); if (request.Id.Value == -1) { return(new CafeResponse { Result = dbCafe.GetAllCafes() }); } else { var cafe = dbCafe.GetCafeById(request.Id.Value); return(new CafeResponse { Result = new Cafe[] { cafe } }); } }