public async Task <IActionResult> PutRelationUserAppointment(int?id, RelationUserAppointment relationUserAppointment)
        {
            if (id != relationUserAppointment.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
        public RelationUADao EntityToDao(RelationUserAppointment entity)
        {
            RelationUADao dao = new RelationUADao
            {
                Id = entity.Id,
                RefAppointmentId = appointmentConverter.EntityToDao(entity.RefAppointmentId),
                RefUserId        = userConverter.EntityToDao(entity.RefUserId),
                AttendanceStatus = entity.AttendanceStatus,
                Comment          = entity.Comment,
                Rating           = entity.Rating
            };

            return(dao);
        }
        public RelationUserAppointment DaoToEntity(RelationUADao dao)
        {
            RelationUserAppointment entity = new RelationUserAppointment
            {
                Id = dao.Id,
                RefAppointmentId = appointmentConverter.DaoToEntity(dao.RefAppointmentId),
                RefUserId        = userConverter.DaoToEntity(dao.RefUserId),
                AttendanceStatus = dao.AttendanceStatus,
                Comment          = dao.Comment,
                Rating           = dao.Rating
            };

            return(entity);
        }
Ejemplo n.º 4
0
        public void Add(RelationUADao dao)
        {
            RelationUserAppointment entity = _converter.DaoToEntity(dao);

            _repository.Add(entity);
        }
        public async Task <ActionResult <RelationUserAppointment> > PostRelationUserAppointment(RelationUserAppointment relationUserAppointment)
        {
            _context.RelationUserAppointment.Add(relationUserAppointment);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetRelationUserAppointment", new { id = relationUserAppointment.Id }, relationUserAppointment));
        }