Ejemplo n.º 1
0
        public void Atend_ValidRequest_ShoulReturnOk()
        {
            var dto = new AttendanceDtos
            {
                GigId = 1
            };

            var result = _controller.Atend(dto);

            result.Should().BeOfType <OkResult>();
        }
Ejemplo n.º 2
0
        public IHttpActionResult Atend(AttendanceDtos dto)
        {
            var        attendeeId = User.Identity.GetUserId();
            Attendance att        = _unitofwork.Attedances.GetAttendance(dto.GigId, attendeeId);

            if (att != null)
            {
                return(BadRequest("Attendance is already done"));
            }

            var attendance = new Attendance
            {
                GigId      = dto.GigId,
                AttendeeId = attendeeId
            };

            _unitofwork.Attedances.Add(attendance);
            _unitofwork.Complete();

            return(Ok());
        }
Ejemplo n.º 3
0
 public Attendance MyAttendances(AttendanceDtos dto, string attendeeId)
 {
     return(_ctx.Attendances
            .Where(g => g.GigId == dto.GigId && g.AttendeeId == attendeeId)
            .FirstOrDefault());
 }