本文整理汇总了C#中BaseController类的典型用法代码示例。如果您正苦于以下问题:C# BaseController类的具体用法?C# BaseController怎么用?C# BaseController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BaseController类属于命名空间,在下文中一共展示了BaseController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendNotifications
public static void SendNotifications(BaseController controller, Message message, SiteConfiguration config, ITopicsSubscriptionsService service)
{
if (!config.Notifications.Subscription.IsDefined)
{
return;
}
var threadUrl = controller.Domain;
threadUrl += controller.Url.RouteUrl(new
{
controller = "Topics",
action = "ShortUrl",
id = message.Topic.Id
});
threadUrl += "#msg" + message.Id;
//Build a generic url that can be replaced with the real values
var unsubscribeUrl = controller.Domain + controller.Url.RouteUrl(new
{
controller = "TopicsSubscriptions",
action = "Unsubscribe",
uid = Int32.MaxValue,
tid = message.Topic.Id,
guid = Int64.MaxValue.ToString()
});
unsubscribeUrl = unsubscribeUrl.Replace(Int32.MaxValue.ToString(), "{0}");
unsubscribeUrl = unsubscribeUrl.Replace(Int64.MaxValue.ToString(), "{1}");
service.SendNotifications(message, controller.User.Id, threadUrl, unsubscribeUrl);
}
示例2: DeleteTag
public static ActionResult DeleteTag(BaseController controller, int id, int? personId = null, int? showId = null)
{
if (id == Photo.NoPic)
{
controller.RollbackTransactionFast();
return new HttpBadRequestResult("Cannot tag this photo.");
}
if (personId.HasValue)
{
// only delete the tag if the photo is not the Person's default photo
controller.DatabaseSession.Execute(
"DELETE FROM PersonPhoto WHERE PhotoId = @PhotoId AND PersonId = @PersonId AND NOT EXISTS (SELECT * FROM Person WHERE PhotoId = @PhotoId AND PersonId = @PersonId)"
, new { PhotoId = id, PersonId = personId.Value });
}
if (showId.HasValue)
{
// only delete the tag if the photo is not the Show's default photo
controller.DatabaseSession.Execute(
"DELETE FROM ShowPhoto WHERE PhotoId = @PhotoId AND ShowId = @ShowId AND NOT EXISTS (SELECT * FROM Show WHERE PhotoId = @PhotoId AND ShowId = @ShowId)"
, new { PhotoId = id, ShowId = showId.Value });
}
return null;
}
示例3: Initialize
/// <summary>
/// Initializes the view
/// </summary>
/// <param name="_gameflowController">The gameflow controller.</param>
public override void Initialize(BaseController _gameflowController)
{
m_gameflowController = (GameflowController)_gameflowController;
m_gameflowController.OnDicesThrowed += OnDicesThrowed;
m_gameflowController.GetModel().OnTurnChanged += OnTurnChanged;
base.Initialize(_gameflowController);
}
示例4: Initialize
/// <summary>
/// Initializes the view and suscribe for pause and unpause event
/// </summary>
/// <param name="_gameflowController">The gameflow controller.</param>
public override void Initialize(BaseController _gameflowController)
{
m_gameflowController = (GameflowController)_gameflowController;
base.Initialize(_gameflowController);
m_gameflowController.GetModel().OnGamePaused += OnGamePaused;
m_gameflowController.GetModel().OnGameUnpaused += OnGameUnpaused;
}
示例5: Initialize
/// <summary>
/// Initializes the view and suscribe for turn changed event
/// </summary>
/// <param name="_gameflowController">The gameflow controller.</param>
public override void Initialize(BaseController _gameflowController)
{
m_gameflowController = (GameflowController)_gameflowController;
base.Initialize(_gameflowController);
m_gameflowController.GetModel().OnTurnChanged += OnTurnChanged;
m_animator = GetComponentInChildren<Animator>();
}
示例6: Initialize
/// <summary>
/// Initializes the view and suscribe for second tick event
/// </summary>
/// <param name="_gameflowController">The _gameflow controller.</param>
public override void Initialize(BaseController _gameflowController)
{
m_gameTimeText = GetComponent<Text>();
m_gameflowController = (GameflowController)_gameflowController;
base.Initialize(_gameflowController);
m_gameflowController.GetModel().OnTimeTick += OnTimeTick;
}
示例7: Workspace
public Workspace(BaseController controller, Uri resources, Action dispose)
{
Resources = resources;
_controller = controller;
_dispose = dispose;
}
示例8: Delete
public static ActionResult Delete(BaseController controller, int id)
{
if (id == Photo.NoPic)
{
controller.RollbackTransactionFast();
return new HttpBadRequestResult("Cannot delete this photo.");
}
var photo = controller.DatabaseSession.Get<Photo>(id);
if (photo == null)
{
return new HttpNotFoundResult("Photo not found");
}
// This is a hard delete.
controller.DatabaseSession.Execute(@"
UPDATE Person SET PhotoId = 1 WHERE PhotoId = @PhotoId;
UPDATE Show SET PhotoId = 1 WHERE PhotoId = @PhotoId;
DELETE FROM PersonPhoto WHERE PhotoId = @PhotoId;
DELETE FROM ShowPhoto WHERE PhotoId = @PhotoId;
DELETE FROM Photo WHERE PhotoId = @PhotoId;
", new { PhotoId = id });
// TODO: delete blob
return null;
}
示例9: RedirectIfAuthorized
protected RedirectToRouteResult RedirectIfAuthorized(BaseController controller, String actionName, String controllerName)
{
RedirectToRouteResult result = new RedirectToRouteResult(new RouteValueDictionary());
controller.When(sub => sub.RedirectIfAuthorized(actionName, controllerName)).DoNotCallBase();
controller.RedirectIfAuthorized(actionName, controllerName).Returns(result);
return result;
}
示例10: RedirectToNotFound
protected RedirectToRouteResult RedirectToNotFound(BaseController controller)
{
RedirectToRouteResult result = new RedirectToRouteResult(new RouteValueDictionary());
controller.When(sub => sub.RedirectToNotFound()).DoNotCallBase();
controller.RedirectToNotFound().Returns(result);
return result;
}
示例11: NotEmptyView
protected RedirectToRouteResult NotEmptyView(BaseController controller, Object model)
{
RedirectToRouteResult result = new RedirectToRouteResult(new RouteValueDictionary());
controller.When(sub => sub.NotEmptyView(model)).DoNotCallBase();
controller.NotEmptyView(model).Returns(result);
return result;
}
示例12: Initialize
public override void Initialize(BaseController _tokenController)
{
m_tokenController = (TokenController)_tokenController;
m_tokenController.GetModel().OnTokenMoved += OnTokenMoved;
m_tokenController.GetModel().OnTokenTeleported += OnTokenTeleported;
m_boardController = GameObject.FindObjectOfType<BoardController>();
base.Initialize(_tokenController);
}
示例13: RedirectToNotFound
protected RedirectToActionResult RedirectToNotFound(BaseController controller)
{
RedirectToActionResult result = new RedirectToActionResult(null, null, null);
controller.When(sub => sub.RedirectToNotFound()).DoNotCallBase();
controller.RedirectToNotFound().Returns(result);
return result;
}
示例14: NotEmptyView
protected RedirectToActionResult NotEmptyView(BaseController controller, Object model)
{
RedirectToActionResult result = new RedirectToActionResult(null, null, null);
controller.When(sub => sub.NotEmptyView(model)).DoNotCallBase();
controller.NotEmptyView(model).Returns(result);
return result;
}
示例15: OnStateEnter
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state.
public override void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
_animator = animator;
gameObject = _animator.gameObject;
transform = gameObject.transform;
rigidbody = gameObject.GetComponent<Rigidbody> ();
_controller = gameObject.GetComponent<BaseController> ();
}