コード例 #1
0
    public IHttpActionResult Delete(int eventId)
    {
        string userKey = this.Request.Headers.GetValues("uk").FirstOrDefault();
        bool   auth    = false;

        using (UserContext userContext = new UserContext())
        {
            auth = userContext.Authenticate(userKey);
        }

        if (auth)
        {
            User user;

            using (UserContext userContext = new UserContext())
            {
                bool retorno = false;
                user = userContext.Get(userKey);

                retorno = EventContext.Delete(eventId, user.Id);

                if (retorno)
                {
                    return(Ok(retorno));
                }
                else
                {
                    return(BadRequest());
                }
            }
        }

        return(Ok("Unauthorized"));
    }
コード例 #2
0
ファイル: PostMedia.cs プロジェクト: Mike97M/Net-Labs
        bool InterfaceEvent.DeleteEvent(int id)
        {
            EventContext eventContext = new EventContext();

            return(eventContext.Delete(id));
        }