public CustomActionResult <MessageItem> add_servico(Servico servico) { MessageItem m = new MessageItem(); ServicoDAO servDAO = new ServicoDAO(); int ID = servDAO.BuscaSeqServico(null); servico.id = ID; if (!servDAO.Inclui(servico)) { m.Code = "500"; return(GetResultBadRequest(m)); } else { foreach (var item in servico.lstAgendaServico) { item.servico = new Servico(); item.servico.id = ID; new AgendaServicoDAO().Inclui(item); } m.Code = ID + ""; return(GetResultOK(m)); } }