示例#1
0
        public async Task <ActionResult <Techstack> > Put(Guid id, [FromBody] Techstack entity)
        {
            try
            {
                var itemCount = await _genericService.UpdateAsync(id, entity);

                if (itemCount > 0)
                {
                    return(CreatedAtAction(nameof(Get), new { id = entity.Id }, entity));
                }

                return(NotFound());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }
示例#2
0
        public async Task <ActionResult <Techstack> > Post(Techstack entity)
        {
            try
            {
                var itemCount = await _genericService.CreateAsync(entity);

                if (itemCount > 0)
                {
                    return(CreatedAtAction(nameof(Get), new { id = entity.Id }, entity));
                }

                return(BadRequest());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.Message));
            }
        }