public void CreateComment(int customerID, string description, int movieID) { using (CinemaEntities database = new CinemaEntities()) { Comment newComment = database.Comment.Create(); //obecna data DateTime myDateTime = DateTime.Now; //format daty poprawny do sql string sqlFormattedDate = myDateTime.ToString("yyyy-MM-dd HH:mm"); newComment.Comment_ID = Convert.ToInt32(database.sp_getSeqCommentID().FirstOrDefault()); newComment.Customer_ID = customerID; newComment.Movie_ID = movieID; newComment.Description = description; newComment.Date = DateTime.Parse(sqlFormattedDate); database.Comment.Add(newComment); database.SaveChanges(); } }