public bool Insert(UserTaskModel userTaskModel) { try { var UT = new UserTask() { ParentTask_ID = userTaskModel.ParentTask_ID, TaskDetail = userTaskModel.TaskDetail, StartDate = userTaskModel.StartDate, EndDate = userTaskModel.EndDate, Priority = userTaskModel.Priority, Status = userTaskModel.Status }; context.UserTasks.Add(UT); context.SaveChanges(); return(true); } catch (Exception ex) { throw ex.InnerException; } }
protected override void Seed(TaskManagerDbContext context) { var task1 = new UserTask { TaskDetail = "This is task1", Status = "Open", StartDate = DateTime.Now, EndDate = DateTime.Now, Priority = 1 }; var task2 = new UserTask { TaskDetail = "This is task 2", Status = "Open", StartDate = DateTime.Now, EndDate = DateTime.Now, Priority = 10 }; context.UserTasks.Add(task1); context.UserTasks.Add(task2); context.SaveChanges(); }