Example #1
0
        public IActionResult Post([FromBody] link li)
        {
            var entity = _ctx.Links.Add(li);

            _ctx.SaveChanges();

            var lastId = _ctx.Links.OrderByDescending(h => h.id).First();

            return(Ok(lastId.id));
        }
        public async Task <IActionResult> DeleteFile([FromRoute] int id)
        {
            var entity = context.files.SingleOrDefault(h => h.id == id);

            if (entity == null)
            {
                return(NotFound("zły numer ID"));
            }
            context.files.Remove(entity);
            context.SaveChanges();
            return(Ok());
        }