Example #1
0
        public IActionResult UpdateStore([FromRoute] int id, [FromBody] UpdateStoreViewModel viewModel)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var store = new Store
            {
                StoreId     = id,
                Name        = viewModel.Name,
                Description = viewModel.Description,
                Category    = viewModel.Category
            };

            try
            {
                _userRepository.UpdateStore(store);
                return(Ok());
            }
            catch (StoreException e)
            {
                return(BadRequest(new { message = e.Message }));
            }
        }
 public UpdateStorePage()
 {
     InitializeComponent();
     BindingContext = new UpdateStoreViewModel();
 }
Example #3
0
        public UpdateStorePage(int idStore)
        {
            InitializeComponent();

            BindingContext = _viewModel = new UpdateStoreViewModel(idStore, map);
        }