private void InsertUser(UserModel user, bool sendEmail) { //Add user by service user.UserId = UserRepository.AutoIncredement(); UserService.InsertUser(user); //Check checkbox if (sendEmail) { //Send mail EmailController email = new EmailController(); string subject = "Your account has been added to NoDesk: TGG"; string toMail = user.Email; string body = "Dear " + user.FirstName + ",\r\n\r\nYour username is: " + user.Username + "\r\nYour password: "******"\r\n\r\nYours sincerly,\r\n\r\nNoDesk"; email.SendMail(subject, toMail, body); } }