Пример #1
0
        public IActionResult Edit(int id)
        {
            var movie = _movieRespository.Update(id);
            //MovieViewModel viewModel = new MovieViewModel();
            //viewModel.Movie = movie;
            MovieViewModel viewModel = _mapper.Map <MovieViewModel>(movie);

            return(View(viewModel));
        }
        public async Task <IActionResult> put(int id, Funcionario model)
        {
            try
            {
                var result = await _repo.GetFuncionarioIdAsync(id);

                if (result == null)
                {
                    return(NotFound("Aluno não encontrato"));
                }

                _repo.Update(model);

                if (await _repo.SaveChangesAsync())
                {
                    return(Ok(model));
                }
            }
            catch (Exception ex)
            {
                return(BadRequest($"Erro: {ex.Message}"));
            }

            return(BadRequest());
        }
Пример #3
0
        //fills the database if it empty.
        public void FillDatabase()
        {
            if (_restaurantRepository.Read().Count == 0)
            {
                var res = new Restaurant
                {
                    Name       = "Bones",
                    Address    = "BonesAddres",
                    Describing = "kendt for et spareRibs",
                    Webside    = "bones.dk",
                    Foods      = new List <Food>()
                };


                var resWithId = _restaurantRepository.Create(res);


                var food = new Food
                {
                    Describing   = "smagte godt",
                    Name         = "SpareRibs",
                    Price        = 120,
                    Rating       = 3,
                    RestaurantId = resWithId.Id
                };

                _foodRespository.Create(food);
                res.Foods.Add(food);
                _restaurantRepository.Update(res);
            }
        }
Пример #4
0
 private void BtnEditRestaurant_OnClicked(object sender, EventArgs e)
 {
     _restaurant.Address    = ResAddress.Text;
     _restaurant.Describing = ResDescribe.Text;
     _restaurant.Name       = ResName.Text;
     _restaurant.Webside    = ResWebside.Text;
     _restaurantRespository.Update(_restaurant);
     Navigation.PopAsync();
 }
 private void BtnEditFood_OnClicked(object sender, EventArgs e)
 {
     _food.Name       = FoodName.Text;
     _food.Describing = FoodDescribe.Text;
     _food.Price      = Convert.ToSingle(FoodPrice.Text);
     _food.Rating     = Convert.ToInt32(starRating);
     _foodRespository.Update(_food);
     Navigation.PopAsync();
 }
Пример #6
0
 private async void BtnAddFood_OnClicked(object sender, EventArgs e)
 {
     if (FoodName.Text != null && starRating != null && FoodPrice.Text != null)
     {
         Food food = new Food();
         food.Name         = FoodName.Text;
         food.Price        = Convert.ToSingle(FoodPrice.Text);
         food.Describing   = FoodDescribe.Text;
         food.Rating       = Convert.ToInt32(starRating);
         food.ImagePath    = imagePath;
         food.RestaurantId = _restaurant.Id;
         _foodRespository.Create(food);
         _restaurant.Foods.Add(food);
         _restaurantRespository.Update(_restaurant);
         await Navigation.PopAsync();
     }
     else
     {
         await DisplayAlert("No Name or no Rating or No Price", "Please Enter a Name, a Price and give a Rating", "Ok");
     }
 }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="person"></param>
        /// <returns></returns>
        public async Task <bool> ModifyPersonAsync(Person person)
        {
            _personRespository.Update(person);

            return(await _unitOfWork.SaveChangeAysnc());
        }
 public void Update(Customer customer)
 {
     repository.Update(customer);
 }
Пример #9
0
 /// <summary>
 /// 更新一个
 /// </summary>
 /// <param name="input"></param>
 public void Update(X input)
 {
     m_coreRepository.Update(input);
 }