Exemplo n.º 1
0
        public async Task <IActionResult> PutMemberStateLog(int id, MemberStateLog memberStateLog)
        {
            if (id != memberStateLog.Id)
            {
                return(BadRequest());
            }

            _context.Entry(memberStateLog).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!MemberStateLogExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Exemplo n.º 2
0
        public async Task <ActionResult <MemberStateLog> > PostMemberStateLog(MemberStateLog memberStateLog)
        {
            _context.MemberStateLogs.Add(memberStateLog);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetMemberStateLog", new { id = memberStateLog.Id }, memberStateLog));
        }
Exemplo n.º 3
0
        public async Task <ActionResult <Member> > PostMember(Member member)
        {
            _context.Members.Add(member);
            var log = new MemberStateLog {
                Member      = member,   //EF 跟踪
                State       = MemberState.Record,
                StateDate   = DateTime.Today,
                TimeStamp   = DateTime.Now,
                SubCategory = "补录会员信息",
                Description = "",
            };

            _context.MemberStateLogs.Add(log);
            await _context.SaveChangesAsync();

            member.StateLogs.Clear();
            return(CreatedAtAction("GetMember", new { id = member.Id }, member));
        }