public CrudReport Create(CreationRequest <TEdit> request) { var input = request.Input; var notification = input.Notification; var model = (TEntity)input.Target; _validator.Validate(model, notification); var wasSaved = false; string editUrl = null; if (notification.IsValid()) { _saver.Create(model); wasSaved = true; editUrl = _urls.UrlFor(model); _newEntityHandler.HandleNew(input); } var flattenedValue = _flattener.Flatten(model); return(new CrudReport(notification, model, flattenedValue) { success = wasSaved, editUrl = editUrl }); }
public EntityFindViewModel Find(FindItemRequest <T> input) { var model = _repository.Find <T>(input.Id); var dto = _flattener.Flatten(model); return(new EntityFindViewModel { Model = dto }); }