Ejemplo n.º 1
0
		//[ResponseType(typeof(UserDTO))]
		public IHttpActionResult CreateUser(UserDTO user)
		{
			if ( _cache.Contains($"user-{user.Id}") )
			{
				return Conflict();
			}

			_cache.Add(new CacheItem($"user-{user.Id}", user), _cachePolicy);


			return user.Id > 10
				? (IHttpActionResult) Created($"http://swagger.localtest.me/api/user/{user.Id}", user)
				: BadRequest();
		}
Ejemplo n.º 2
0
        public IHttpActionResult UpdateUser([FromUri] int id, [FromBody] UserDTO user)
        {
            _cache.Set(new CacheItem($"user-{id}", user), _cachePolicy);

            return(user.Id > 10 ? (IHttpActionResult)Ok() : BadRequest());
        }