/// <summary> /// Delete the model associated with the id. /// </summary> /// <param name="id"></param> /// <returns></returns> public static BoolResult <T> Delete(int id) { IEntityService <T> service = EntityRegistration.GetService <T>(); IActionContext context = EntityRegistration.GetContext <T>(); context.Id = id; return(service.Delete(context)); }
/// <summary> /// Performs the actual entity action specified by the delegate <paramref name="executor"/> /// </summary> /// <param name="entity"></param> /// <param name="executor"></param> /// <returns></returns> protected static void DoEntityAction(T entity, Action <IActionContext, IEntityService <T> > executor) { IActionContext ctx = EntityRegistration.GetContext <T>(); ctx.CombineMessageErrors = true; ctx.Item = entity; IEntityService <T> service = EntityRegistration.GetService <T>(); executor(ctx, service); }