Exemplo n.º 1
0
        public R.ResultVm <ServerOnlyVm> GetServer(string name)
        {
            var result = new R.ResultVm <ServerOnlyVm>().FromEmptyFailure();

            Demand <string> .That(name, "name").HasNonEmptyValue().Result(result);

            if (result.Errors.Count == 0)
            {
                try
                {
                    return(new ResultVm <ServerOnlyVm>().FromSuccessObject(_repo.GetServer(name).ToServerOnlyVm()));
                }
                catch (Exception ex)
                {
                    return(new ResultVm <ServerOnlyVm>().FromException(ex));
                }
            }

            return(result);
        }