コード例 #1
0
ファイル: MemberController.cs プロジェクト: zactWu/Daisy
        public async Task <IActionResult> PutMember(int id, Member member)
        {
            if (id != member.ProjectId)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #2
0
        public async Task <ActionResult <LikeMoment> > PostLikeMoment(LikeMoment likeMoment)
        {
            _context.LikeMoment.Add(likeMoment);
            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateException)
            {
                if (LikeMomentExists(likeMoment.MomentId, likeMoment.Account))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtAction("GetLikeMoment", new { id = likeMoment.MomentId }, likeMoment));
        }