Example #1
0
        public async Task <EntityCommandResult <RetrospectiveItem> > ExecuteAsync(CreateOrUpdateRetrospectiveItemCommand source)
        {
            string storedProcName = string.IsNullOrEmpty(source.RetrospectiveItemId) ? "InsertRetrospectiveItem" : "UpdateRetrospectiveItem";

            var retroItem = new RetrospectiveItem
            {
                Votes       = source.Votes,
                Description = source.Description,
                Id          = string.IsNullOrEmpty(source.RetrospectiveItemId) ? Guid.NewGuid().ToString() : source.RetrospectiveItemId
            };

            try {
                StoredProcedureResponse <dynamic> procresult = await repository.ExecuteStoredProc(storedProcName, new dynamic[] { source.RetrospectiveId, source.CategoryId, retroItem });

                return(new EntityCommandResult <RetrospectiveItem> {
                    Response = procresult, Entity = retroItem, IsSuccess = true
                });
            }
            catch (Exception ex) {
                return(new EntityCommandResult <RetrospectiveItem> {
                    IsSuccess = false, Response = ex
                });
            }
        }
Example #2
0
 public EntityCommandResult <RetrospectiveItem> Execute(CreateOrUpdateRetrospectiveItemCommand source)
 {
     return(ExecuteAsync(source).Result);
 }
 public async static Task <EntityCommandResult <RetrospectiveItem> > CreateRetrospectiveItemAsync(this ICommandDispatcher dispatcher, CreateOrUpdateRetrospectiveItemCommand command)
 {
     return(await dispatcher.DispatchAsync <CreateOrUpdateRetrospectiveItemCommand, EntityCommandResult <RetrospectiveItem> >(command));
 }