public async Task <IActionResult> PutLCMsg(long id, LCMsg lCMsg) { if (id != lCMsg.Id) { return(BadRequest()); } _context.Entry(lCMsg).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LCMsgExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <LCMsg> > PostLCMsg(LCMsg lCMsg) { if (lCMsg.Username == null) { return(BadRequest()); } if (lCMsg.Content == null) { return(BadRequest()); } if (lCMsg.Id != null) { return(BadRequest()); } lCMsg.Id = Utils.IdGen.UnixMillis(); _context.LCMsgs.Add(lCMsg); await _context.SaveChangesAsync(); return(CreatedAtAction("GetLCMsg", new { id = lCMsg.Id }, lCMsg)); }