public void ShouldreturnValidWhenEditCommandIsValid()
        {
            var command = new EditEquipmentCommand();

            command.Id           = Guid.NewGuid();
            command.Description  = "Edited Equipment";
            command.Status       = EEquipmentStatus.Free;
            command.PurchaseDate = DateTime.Now;
            command.IdCollege    = Guid.NewGuid();
            var result = _handler.Handle(command);

            Assert.AreEqual(true, result.Status);
        }
Esempio n. 2
0
        public ICommandResult Handle(EditEquipmentCommand command)
        {
            var equipment = new Equipment(command.Description, command.Status, command.PurchaseDate);

            AddNotifications(equipment.Notifications);

            if (Invalid)
            {
                return(new CommandResult(false, "Erro ao editar registro", Notifications));
            }

            _repository.Edit(command);
            return(new CommandResult(true, "Registro editado com sucesso", null));
        }
Esempio n. 3
0
 public void Edit(EditEquipmentCommand command)
 {
     _db.Connection().Execute(
         "spEditEquipment",
         new
     {
         id           = command.Id,
         description  = command.Description,
         status       = command.Status,
         purchaseDate = command.PurchaseDate,
         idCollege    = command.IdCollege
     },
         commandType: CommandType.StoredProcedure
         );
 }
Esempio n. 4
0
 public ICommandResult Post([FromBody] EditEquipmentCommand command)
 {
     return(_handler.Handle(command));
 }
        public ActionResult Edit(EquipmentViewModel equipmentViewModel)
        {
            if (ModelState.IsValid)
            {
                var editEquipmentCommand = new EditEquipmentCommand();
                Mapper.CreateMap<EquipmentViewModel, EditEquipmentCommand>();
                Mapper.Map(equipmentViewModel, editEquipmentCommand);
                _commandProcessor.Process<EditEquipmentCommand, CommandResult>(editEquipmentCommand, ModelState);

                if (!ModelState.IsValid)
                    return View();
                return this.RedirectToAction(c => c.Index(null, null));
            }

            return View();
        }
 public void Edit(EditEquipmentCommand command)
 {
 }