Example #1
0
        public virtual IActionResult GetById(Tid id)
        {
            if (!ControllerConfigurations.ImplementsGetById)
            {
                return(IO.Error(HttpStatusCode.MethodNotAllowed));
            }

            using (var s = new MethodAttributesEagerScope <StorageModel>(MethodBase.GetCurrentMethod()))
            {
                var result = IO.SafeRun(() => Service.GetById(id), HttpStatusCode.NotFound);

                return(IO.Map <DomainModel, TransferModel>(result));
            }
        }
Example #2
0
        public virtual IActionResult CreateNew(TransferModel entity)
        {
            if (!ControllerConfigurations.ImplementsCreateNew)
            {
                return(IO.Error(HttpStatusCode.MethodNotAllowed));
            }

            using (var s = new MethodAttributesEagerScope <StorageModel>(MethodBase.GetCurrentMethod()))
            {
                var domain = Mapper.Map <DomainModel>(entity);

                var result = IO.SafeRun(() => Service.CreateNew(domain));

                return(IO.Map <DomainModel, TransferModel>(result));
            }
        }