예제 #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
        bool InterfaceEvent.DeleteEvent(int id)
        {
            EventContext eventContext = new EventContext();

            return(eventContext.Delete(id));
        }