Пример #1
0
        public void Delete(int id)
        {
            Mapper_User delete = new Mapper_User();

            delete.Model = delete.Load(id);
            delete.Delete();
        }
Пример #2
0
        public IHttpActionResult Get(int id)
        {
            Mapper_User mapper  = new Mapper_User();
            User        retorno = (User)mapper.Load(id);

            return(ResponseMessage(Request.CreateResponse <Object>(HttpStatusCode.OK, retorno)));
        }
Пример #3
0
        public IHttpActionResult GetByUser(int id)
        {
            Mapper_List list       = new Mapper_List();
            Mapper_User mapperUser = new Mapper_User();
            User        user       = mapperUser.Load(id) as User;

            IList <List> retorno = list.GetByUser(user);

            return(ResponseMessage(Request.CreateResponse <Object>(HttpStatusCode.OK, retorno)));
        }
Пример #4
0
        public IHttpActionResult Post([FromBody] List value)
        {
            try
            {
                Mapper_User    mapperUser = new Mapper_User();
                Mapper_List    mapper     = new Mapper_List();
                Model_Abstract user       = mapperUser.Load(value.Fk_User);
                //mapper.Validate(value);
                value.User   = user as User;
                mapper.Model = value;
                mapper.Register();

                return(ResponseMessage(Request.CreateResponse <Object>(HttpStatusCode.OK, mapper.Model)));
            }
            catch (Exception e)
            {
                var retorno = new
                {
                    Erro = e.Message
                };

                return(ResponseMessage(Request.CreateResponse <Object>(HttpStatusCode.OK, retorno)));
            }
        }