Exemple #1
0
        public async Task <ICommandResult> Handle(MeasureUnitAddCommand message)
        {
            try
            {
                MeasureUnit measure = new MeasureUnit();
                measure.Add(message);
                await _measureUnitService.AddToDb(measure);

                ICommandResult result = new CommandResult()
                {
                    Message  = "",
                    ObjectId = measure.Id,
                    Status   = CommandResult.StatusEnum.Sucess
                };
                return(result);
            }
            catch (Exception e)
            {
                e.Data["Param"] = message;
                ICommandResult result = new CommandResult()
                {
                    Message = e.Message,
                    Status  = CommandResult.StatusEnum.Fail
                };
                return(result);
            }
        }