protected override void Seed(MvcApplication1Context context) { var r = new Random(); var items = Enumerable.Range(1, 50).Select(o => new TodoItem { DueDate = new DateTime(2012, r.Next(1, 12), r.Next(1, 28)), Priority = (byte)r.Next(10), Todo = o.ToString() }).ToArray(); context.TodoItems.AddOrUpdate(item => new { item.Todo }, items); }
public static IQueryable <ProcessoCliente> GetListaProcessosClientes() { MvcApplication1Context db = new MvcApplication1Context(); var processos = (from p in db.Processos join c in db.Clientes on p.IDCliente equals c.IDCliente orderby p.IDProcesso descending select new { IDProcesso = p.IDProcesso, NomeCliente = c.Nome, DataInserido = p.DataInserido, Estado = p.Estado }).ToList().Select(c => new ProcessoCliente { IDProcesso = c.IDProcesso, NomeCliente = c.NomeCliente, DataInserido = c.DataInserido.ToString(), Estado = c.Estado }); return(processos.AsQueryable <ProcessoCliente>()); }