Beispiel #1
0
        public void Post(int groupId, [FromBody] Message message)
        {
            message.GroupId = groupId;
            _db.Messages.Add(message);
            Group group = _db.Groups.FirstOrDefault(gp => gp.GroupId == message.GroupId);

            group.Messages.Add(message);
            _db.Entry(group).State = EntityState.Modified;
            _db.SaveChanges();
        }
Beispiel #2
0
 public void Put(int id, [FromBody] Group group)
 {
     group.GroupId          = id;
     _db.Entry(group).State = EntityState.Modified;
     _db.SaveChanges();
 }