コード例 #1
0
ファイル: GroceryService.cs プロジェクト: azuletag/2share
        public IResponse UpdateGroceryList(GroceryListViewModel groceryList)
        {
            // Convertion for groceryList view model object to a POCO groceryList object
            GroceryList groceryListUpdated = new GroceryList
            {
                GroceryListID = groceryList.GroceryListId,
                Products      = groceryList.Products.Select(x => new ProductGroceryList
                {
                    ProductID = x.ProductId,
                    Tagged    = x.Tagged,
                }).ToList()
            };

            try
            {
                this.GroceryRepository.UpdateGroceryList(groceryListUpdated);
                this.GroceryRepository.Save();
                return(new Response("0", "Success"));
            }
            catch (Exception ex)
            {
                //Logging exception and return an error response
            }

            return(new Response("1", "Error updating grocery list."));
        }
コード例 #2
0
 public GroceryListController(IIngredientData ingredientData)
 {
     _ingredientData = ingredientData;
     GroceryList     = new GroceryListViewModel
     {
         IngredientList = new List <Ingredient>()
     };
 }
コード例 #3
0
        public GeneratedGroceryList(IList <ViewModel.GroceryListItemEditVM> list, DateTime startDate, DateTime finishDate)
        {
            InitializeComponent();

            GroceryListViewModel viewModel = new GroceryListViewModel();

            viewModel.Title = string.Format("Do dia {0} até o dia {1}",
                                            startDate.ToString("dd/MM/yyyy"), finishDate.ToString("dd/MM/yyyy"));

            viewModel.GroupedItems = InitializeListView(list);

            this.BindingContext = viewModel;
        }
コード例 #4
0
ファイル: GroceryController.cs プロジェクト: azuletag/2share
        public IHttpActionResult GroceryList([FromBody] GroceryListViewModel groceryListViewModel)
        {
            IResponse response = this.GroceryService.UpdateGroceryList(groceryListViewModel);

            return(Ok(response));
        }
コード例 #5
0
 public GroceryListViewModelTests()
 {
     _repository        = new MockRepository();
     _bluetoothServices = new MockBluetoothServices();
     _viewModel         = new GroceryListViewModel(_repository, _bluetoothServices);
 }
コード例 #6
0
 public GroceryListPage()
 {
     viewModel = new GroceryListViewModel();
     InitializeComponent();
     BindingContext = viewModel;
 }