Esempio n. 1
0
        public void DeleteKnife(int knifeId)
        {
            Knive knife = this.context.Knives.Find(knifeId);

            this.context.Knives.Remove(knife);
            this.context.SaveChanges();
        }
Esempio n. 2
0
        public void UpdateProduct(EditProductBindingModel bind)
        {
            Knive knive = this.context.Knives.Find(bind.Id);

            knive.Price    = bind.Price;
            knive.ImageUrl = bind.ImageUrl;
            knive.Name     = bind.Name;

            this.context.SaveChanges();
        }
Esempio n. 3
0
        public void AddProduct(AddProductBindingModel bindingModel)
        {
            Knive knive = new Knive()
            {
                ImageUrl = bindingModel.ImageUrl,
                Name     = bindingModel.Name,
                Price    = bindingModel.Price
            };

            this.context.Knives.Add(knive);
            this.context.SaveChanges();
        }
Esempio n. 4
0
        public EditProductViewModel GetEditProductViewModel(int id)
        {
            Knive knife = this.context.Knives.Find(id);
            EditProductViewModel viewModel = new EditProductViewModel()
            {
                Id       = knife.Id,
                Price    = knife.Price,
                ImageUrl = knife.ImageUrl,
                Name     = knife.Name
            };

            return(viewModel);
        }
Esempio n. 5
0
 private void Awake()
 {
     knive = GetComponentInParent <Knive>();
 }