public List <DTO_OpenDraw> CreateDraw(DTO_NewDraw draw) { using (DB_122744_doodleEntities db = new DB_122744_doodleEntities()) { List <DTO_OpenDraw> openDrawList = new List <DTO_OpenDraw>(); DTO_OpenDraw openDraw = new DTO_OpenDraw(); int? temp = 1; draws sqlobj = new draws(); sqlobj.CategoryID = draw.DrawCategoryID; sqlobj.DoodlerUserID = draw.DoodlerID; sqlobj.Answer = draw.Answer; sqlobj.DrawStatusID = temp; sqlobj.StartTime = draw.StartTime; sqlobj.EndTime = System.DateTime.Now; db.draws.Add(sqlobj); db.SaveChanges(); int temp2 = 1; openDraw.DrawID = sqlobj.DrawID; //openDraw.Doodler = db.users.Where(c => c.UserID.Equals(draw.DoodlerID)).FirstOrDefault().DisplayName; //openDraw.DrawStatusDesc = db.drawStatus.Where(c => c.DrawStatusID.Equals(temp2)).FirstOrDefault().DrawStatusDesc; //openDraw.DrawCategoryName = db.drawCategories.Where(c => c.DrawCategoryID.Equals(draw.DrawCategoryID)).FirstOrDefault().DrawCategoryName; openDraw.Doodler = "Test Doodler"; openDraw.DrawStatusDesc = "Test DrawStatusDesc"; openDraw.DrawCategoryName = "Test DrawCategoryName"; openDraw.StartTime = System.DateTime.Now; openDrawList.Add(openDraw); return(openDrawList); } }
private void runDrawToolStripMenuItem_Click(object sender, EventArgs e) { draws d = new draws(); d.ShowDialog(); }