public ActionResult ConstructFrom() { OperationSymbol operationSymbol; Entity entity = null; if (this.IsLite()) { Lite <Entity> lite = this.ExtractLite <Entity>(); entity = OperationLogic.ServiceConstructFromLite(lite, operationSymbol = this.GetOperationKeyAssert(lite.EntityType)); } else { MappingContext context = this.UntypedExtractEntity().UntypedApplyChanges(this).UntypedValidate(); entity = (Entity)context.UntypedValue; if (context.HasErrors()) { return(context.ToJsonModelState()); } try { entity = OperationLogic.ServiceConstructFrom(entity, operationSymbol = this.GetOperationKeyAssert(entity.GetType())); } catch (IntegrityCheckException e) { context.ImportErrors(e.Errors); return(context.ToJsonModelState()); } } return(this.DefaultConstructResult(entity, operation: operationSymbol)); }
public ActionResult ShipOrder() { MappingContext <OrderEntity> ctx = this.ExtractEntity <OrderEntity>().ApplyChanges(this); if (ctx.HasErrors()) { return(ctx.ToJsonModelState()); } var shipDate = this.ParseValue <DateTime>("shipDate"); try { ctx.Value.Execute(OrderOperation.Ship, shipDate); } catch (IntegrityCheckException e) { ctx.ImportErrors(e.Errors); return(ctx.ToJsonModelState()); } return(this.DefaultExecuteResult(ctx.Value)); }