public ActionResult Create(CTMViewModel model) { var ctm = new CTM(); fillCTM(ctm, model); CTMService.saveCTM(ctm); model.ListaEquipamentos = new List<SelectListItem>(); model.ListaEquipamentos.AddRange(EquipamentoService.getEquipamentos(1).Select(x => new SelectListItem() { Text = x.Descricao, Value = x.IDEquipamento.ToString() })); addMensagemSucesso("CTM criado com sucesso!"); return RedirectToAction("Edit", new { idCTM = ctm.IDCTM }); }
private void fillCTM(CTM ctm, CTMViewModel model) { ctm.IDCliente = model.IDCliente; ctm.IDEquipamento = model.IDEquipamento; ctm.IDUsuario = visitor.ID; ctm.SerialNumber = model.SerialNumber; ctm.PartNumber = model.Partnumber; }
private CTMViewModel getViewModel(CTM ctm) { var model = new CTMViewModel() { IDCTM = ctm.IDCTM, IDCliente = ctm.IDCliente, DataCriacao = ctm.DataCriacao, DataModificacao = ctm.DataModificacao, IDEquipamento = ctm.IDEquipamento, IDUsuario = ctm.IDUsuario, NomeCliente = ctm.Clientes.Nome, Partnumber = ctm.PartNumber, SerialNumber = ctm.SerialNumber, PossuiFIRC = ctm.CtmFirc != null, PossuiLaudo = ctm.CtmLaudo != null, PossuiOrdemServico = ctm.CtmOrdemServico != null, PossuiSegvoo = ctm.CtmSegVoo != null }; return model; }
public void delete(CTM ctm) { dao.delete(ctm); }