Exemple #1
0
        protected override Appointment MapperModelToEntity(AppointmentViewModel viewModel)
        {
            var bodegas = new Appointment();

            if (viewModel.Id != null && viewModel.Id != Guid.Empty)
            {
                bodegas            = EntityService.GetById(viewModel.Id.Value);
                bodegas.Agendas    = agendaService.GetById(viewModel.AgendasId);
                bodegas.EstadoCita = TipoIdentificacionService.GetById(viewModel.EstadoCitaId.Value);
                bodegas.Personas   = PersonaService.GetById(viewModel.PersonasId.Value);
                bodegas.TipoCita   = TipoIdentificacionService.GetById(viewModel.TipoCitaId.Value);
                bodegas.Usuario    = UsuarioService.GetById(viewModel.UsuarioId);
            }
            return(Mapper.Map(viewModel, bodegas));
        }
        public JsonResult GetById(int id)
        {
            var agenda = Mapper.Map <AgendaDTO>(AgendaService.GetById(id));

            return(Json(agenda, JsonRequestBehavior.AllowGet));
        }