Beispiel #1
0
        public GenericResponseModel <CoffeeModel> GetCoffeeByID(long id)
        {
            var result = new GenericResponseModel <CoffeeModel>();

            try
            {
                var data = new CoffeeDA().GetCoffeeByID(id);

                List <CoffeeModel> items = data.AsEnumerable().Select(a => new CoffeeModel
                {
                    ID    = a.Field <int>("ID"),
                    Name  = a.Field <string>("Name"),
                    Price = a.Field <int>("Price"),
                    Size  = a.Field <string>("Size")
                }).ToList();

                result.Value  = items[0];
                result.Status = true;
            }
            catch (Exception ex)
            {
                result.ErrorMessage = ex.ToString();
            }

            return(result);
        }
Beispiel #2
0
        public GenericResponseModel <string> GetCoffeeList()
        {
            var result = new GenericResponseModel <string>();

            try
            {
                var da = new CoffeeDA();
                // result.Value = da.Login();
                result.Status = true;
            }
            catch (Exception ex)
            {
                result.ErrorMessage = ex.ToString();
            }

            return(result);
        }