Exemplo n.º 1
0
        public void DoSomeProcess()
        {
            WriteLine("BusinessProcess1 starting");
            WriteLine("Print existing Item");
            _unitOfWork.BusinessEntities1Repo.GetAll();
            var newItem = new BusinessEntity1();

            while (true)
            {
                WriteLine("Please input new Item Id (int)");
                var input = ReadLine();
                if (int.TryParse(input, out var result))
                {
                    newItem.Id = result;
                    break;
                }

                WriteLine("Incorrect input");
            }

            WriteLine("Please input new Item Name ");
            newItem.Name = ReadLine();

            _unitOfWork.BusinessEntities1Repo.Create(newItem);
            _unitOfWork.BusinessEntities1Repo.GetAll();
            WriteLine("BusinessProcess1 finished");
        }
        public void Update(BusinessEntity1 item)
        {
            WriteLine("Item updated");
            var value = db.Single(x => x.Id == item.Id);

            value.Name        = item.Name;
            value.Description = item.Description;
        }
 public IActionResult Save([FromBody] BusinessEntity1 item)
 {
     // emulation db-save
     _uow.BusinessEntities1Repo.Update(item);
     return(Ok());
 }
 public void Create(BusinessEntity1 item)
 {
     WriteLine("Item created");
     db.Add(item);
 }