//Delete the UserStory on the basis of the userStoryID public static List<UserStory> DeleteUserStory(UserStory s) { var us = (from userStory in dataContext.UserStories where userStory.UserStoryID == s.UserStoryID select userStory).SingleOrDefault(); dataContext.UserStories.Remove(us); dataContext.SaveChanges(); return GetAllUserStories(); }
//Update the UserStory on the basis of the userStoryID public static List<UserStory> UpdateUserStory(UserStory s) { //get the details of the userStory var us = (from userStory in dataContext.UserStories where userStory.UserStoryID == s.UserStoryID select userStory).SingleOrDefault(); us.Story = s.Story; us.ProjectID = s.ProjectID; dataContext.SaveChanges(); return GetAllUserStories(); }
//Insert UserStory public static List<UserStory> InsertUserStory(UserStory s) { dataContext.UserStories.Add(s); dataContext.SaveChanges(); return GetAllUserStories(); }