Пример #1
0
        public ActionResult OnPost()
        {
            if (ModelState.IsValid)
            {
                Models.Linhas newLinha = new Models.Linhas();
                Models.Ticket ticket   = new Models.Ticket();
                newLinha.Number      = number.Trim().ToLower();
                newLinha.Description = description.Trim().ToLower();
                ticket.ID            = TicketID;
                newLinha.Ticket      = ticket;

                if (Call.Calls.CreateLines(newLinha).Result)
                {
                    return(RedirectToPage("Linhas"));
                }
                else
                {
                    Message = "Erro ao realizar operação!";
                    return(Page());
                }
            }
            else
            {
                return(Page());
            }
        }
Пример #2
0
        public void PreencherListaLinhas(DataTable dt)
        {
            foreach (DataRow row in dt.Rows)
            {
                lines = new Models.Linhas();
                Models.Ticket ticket = new Models.Ticket();

                lines.ID          = Guid.Parse(row.ItemArray[0].ToString());
                lines.Number      = row.ItemArray[1].ToString();
                lines.Description = row.ItemArray[2].ToString();
                ticket.ID         = Guid.Parse(row.ItemArray[3].ToString());
                ticket.Price      = decimal.Parse(row.ItemArray[4].ToString());
                lines.Ticket      = ticket;

                linhas.Add(lines);
            }
        }