internal static Checkin SaveCheckIn(int projectId, int userId, CheckInInfo checkInInfo) { var context = new trackgitentitycontext(); var checkIn = new Checkin { Project = context.Projects.First(p => p.Id == projectId), User = context.Users.First(u => u.Id == userId), Comment = checkInInfo.Comment }; context.AddToCheckins(checkIn); context.SaveChanges(); return checkIn; }
internal static void SendEmail(Checkin checkin) { using (var mailMessage = new MailMessage(SendEmailAccount, checkin.User.EmailId, "hello subject", "hello body")) { mailMessage.IsBodyHtml = false; using (var smtpClient = new SmtpClient(SendEmailHost, SendEmailPort) { EnableSsl = true, UseDefaultCredentials = false, Credentials = new NetworkCredential(SendEmailAccount, SendEmailPwd) }) { mailMessage.IsBodyHtml = false; smtpClient.Send(mailMessage); } } }
/// <summary> /// Create a new Checkin object. /// </summary> /// <param name="id">Initial value of the Id property.</param> /// <param name="userId">Initial value of the UserId property.</param> /// <param name="projectId">Initial value of the ProjectId property.</param> public static Checkin CreateCheckin(global::System.Int32 id, global::System.Int32 userId, global::System.Int32 projectId) { Checkin checkin = new Checkin(); checkin.Id = id; checkin.UserId = userId; checkin.ProjectId = projectId; return checkin; }
/// <summary> /// Deprecated Method for adding a new object to the Checkins EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToCheckins(Checkin checkin) { base.AddObject("Checkins", checkin); }