Beispiel #1
0
        public async Task <ActionResult <Check> > PostCheck([FromBody] Check check)
        {
            try
            {
                Member member = await _memberService.GetAsync((int)check.MemberId);

                check.Member = member;
                //check.Purchases = new List<Purchase>();
                check = await _checkService.CreateAsync(check);

                member.Checks.Add(check);
                await _memberService.UpdateAsync(member);
            }
            catch (Exception e)
            {
                return(BadRequest(e.InnerException));
            }
            //return CreatedAtAction("GetCheck", new { id = check.Id }, check);
            return(CreatedAtAction(nameof(GetCheck), new { id = check.Id }, check));
        }