static void Main(string[] args) { ChannelFactory <IStudent> factory = new ChannelFactory <IStudent>(new NetTcpBinding(), new EndpointAddress("net.tcp://127.255.0.0:11000/InputRequest")); IStudent proxy = factory.CreateChannel(); proxy.AddStudent("pr88-2015", "Stefan", "Ruvceski"); proxy.AddStudent("pr89-2015", "Stefana", "Ruvceska"); proxy.AddStudent("pr90-2015", "Stefani", "Ruvceska"); proxy.AddStudent("pr91-2015", "Stefanu", "Ruvceski"); proxy.AddStudent("pr92-2015", "Stefa", "Ruvceska"); foreach (Student s in proxy.RetrieveAllStudents()) { Console.WriteLine(s.Index); } Console.WriteLine("-----------------------------------------------"); proxy.RemoveStudent("pr90-2015"); foreach (Student s in proxy.RetrieveAllStudents()) { Console.WriteLine(s.Index); } Console.WriteLine("-----------------------------------------------"); proxy.EditStudent("pr89-2015", "Teodora", "Ruvceska"); foreach (Student s in proxy.RetrieveAllStudents()) { Console.WriteLine(s.Index); } Console.ReadKey(); }
public void Create([FromBody] Student Student) { if (ModelState.IsValid) { objStudent.AddStudent(Student); } }
public ActionResult CreateStudent(tbl_MCE_Student_Basic MCE_Student_Basic) { MCE_Student_Basic.vchPassword = Util.GetHashByte("password"); _student.AddStudent(MCE_Student_Basic); ModelState.Clear(); var gender_Type = new List <DDL_Data> { new DDL_Data() { vchText = "Male", vchValue = "Male" }, new DDL_Data() { vchText = "Female", vchValue = "Famale" }, new DDL_Data() { vchText = "Others", vchValue = "Others" } }; ViewBag.gender_Type = gender_Type.ToList(); ViewBag.courseList = _course.CourseList().ToList(); ViewBag.joincategoryList = _joincategory.JoinCategoryList().ToList(); TempData["Success"] = "Data Inserted Successfully"; return(View()); }
private void BtnAddStudent_Click(object sender, EventArgs e) { var selectedcourse = listBox1.CheckedItems; var properties = selectedcourse.GetType().GetProperties(); AddEditStudentDto model = new AddEditStudentDto(); model.Courses = new List <int>(); foreach (var item in listBox1.CheckedItems) { model.Courses.Add(Convert.ToInt32(item.GetType().GetProperty("CourseId").GetValue(item, null))); } model.ImageUrl = txtImageUrl.Text; model.Name = TxtName.Text; model.FName = TxtFName.Text; model.Email = TxtEmail.Text; model.Phone = TxtStudentPhone.Text; model.Password = TxtPassword.Text; model.ConfirmPassword = TxtConfirmPassword.Text; model.Dob = DtpStudetDob.Text.ToString(); model.UserId = USER_ID; _StudentRepo.AddStudent(model); RefreshStudentTable(); MessageBox.Show("Student Added Successfully"); RefreshStudentForm(); }
public IActionResult Create(StudentViewModel model) { if (ModelState.IsValid) { string uniqueFileName = null; if (model.Photo != null) { string uploadsFolder = Path.Combine(hostingEnvironment.WebRootPath, "images"); uniqueFileName = Guid.NewGuid().ToString() + "_" + model.Photo.FileName; string filePath = Path.Combine(uploadsFolder, uniqueFileName); model.Photo.CopyTo(new FileStream(filePath, FileMode.Create)); } Student newEmployee = new Student { Surname = model.Surname, OtherName = model.OtherName, PhoneNumber = model.PhoneNumber, Email = model.Email, HomeAddress = model.HomeAddress, City = model.City, State = model.State, Passport = uniqueFileName }; _student.AddStudent(newEmployee); // _employee.AddEmployee(employee); return(RedirectToAction(nameof(Create))); } else { return(View()); } }
async Task Save() { if (String.IsNullOrWhiteSpace(Student.studentID) && String.IsNullOrWhiteSpace(Student.firstName) && String.IsNullOrWhiteSpace(Student.courseID) && String.IsNullOrWhiteSpace(Student.idNumber) && String.IsNullOrWhiteSpace(Student.password)) { await _pageService.DisplayAlert("Error", "Please enter All the Fields", "OK"); return; } if (Student.id == 0) { await _studentStore.AddStudent(Student); StudentAdded?.Invoke(this, Student); } else { await _studentStore.UpdateStudent(Student); StudentUpdated?.Invoke(this, Student); } await _pageService.PopModalAsync(); }
public async Task <IActionResult> Add(DAL.Student student) { await _student.AddStudent(student); await AddLog(student.FIRSTNAME + " adlı öğrenci eklendi."); return(RedirectToAction("Add", new { success = true })); }
public async Task <IActionResult> AddEmployee(StudentViewModel model) { if (await _student.AddStudent(model)) { return(View()); } return(View()); }
public IActionResult AddStudent([Bind("Name,Number,City")] Student student) { if (ModelState.IsValid) { student = studentService.AddStudent(student.Name, student.Number, student.City); return(RedirectToAction(nameof(Index))); } return(View(student)); }
public IActionResult PostNewStudent(StudentRecords record) { if (!ModelState.IsValid) { return(BadRequest("Invalid Data")); } var response = repo.AddStudent(record); return(Ok(response)); }
public async Task <IActionResult> Post([FromBody] Models.Student value) { try { await Student.AddStudent(value); return(Ok()); } catch (Exception ex) { return(StatusCode(500, ex.Message)); } }
public ActionResult Post(StudentDto studentDto) { var result = _StudentValidation.Validate(studentDto); if (result.IsValid) { return(Json(_student.AddStudent(studentDto))); } else { return(BadRequest(result.Errors)); } }
public IActionResult AddStudent([FromBody] PostModel inUsers) { Student obj = JsonConvert.DeserializeObject <Student>(inUsers.Key); try { var result = _student.AddStudent(obj); return(Ok(result)); } catch (Exception ex) { throw; } }
public IActionResult Post([FromBody] Student student) { try { if (ModelState.IsValid) { studentrepository.AddStudent(student); return(StatusCode(StatusCodes.Status201Created, "Record Created successfully.")); } return(StatusCode(StatusCodes.Status400BadRequest, ModelState)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public void AddStudent(StudentInf studentInf) { int result = student.AddStudent(studentInf); switch (result) { case 1: JScript.AlertAndRedirect("添加学生成功!", "AddStudent.aspx"); break; case -2: JScript.Alert("添加失败,该学号已经存在,请换其他学号"); JScript.GoHistory(-1); break; case 0: JScript.Alert("添加失败,请仔细检查输入!"); JScript.GoHistory(-1); break; } }
static void Main(string[] args) { ChannelFactory <IStudent> factory = new ChannelFactory <IStudent>(new NetTcpBinding(), new EndpointAddress("net.tcp://localhost:10100/Input")); IStudent proxy = factory.CreateChannel(); string unos = ""; string[] unosi; while (true) { Console.WriteLine("Unesi studenta u formatu [broj_indexa, ime, prezime] ili unesi 'end' "); unos = Console.ReadLine(); if (unos.ToLower() == "end") { break; } unosi = unos.Split(','); proxy.AddStudent(unosi[0], unosi[1], unosi[2]); Trace.TraceInformation($"{unosi[0]}, {unosi[1]}, {unosi[2]} je uspesno unet.\n"); } List <string> indexi = new List <string>(); foreach (string el in proxy.RetrieveAllIndexes()) { indexi.Add(el); } Console.WriteLine("Svi trenutni indexi:"); foreach (string index in indexi) { Console.WriteLine(index); } Console.ReadKey(); }
public IActionResult Create(StudentViewModel students) { if (ModelState.IsValid) { string UniqueFileName = null; if (students.Photo != null) { string uploadsFolder = Path.Combine(hostEnvironment.WebRootPath, "images"); UniqueFileName = Guid.NewGuid().ToString() + "_" + students.Photo.FileName; string filePath = Path.Combine(uploadsFolder, UniqueFileName); students.Photo.CopyTo(new FileStream(filePath, FileMode.Create)); } Student stud = new Student() { Surname = students.Surname, Othernames = students.Othernames, PhoneNo = students.PhoneNo, Email = students.Email, Address = students.Address, City = students.City, Age = students.Age, State = students.State, Passport = UniqueFileName, }; _student.AddStudent(stud); return(RedirectToAction(nameof(Create), new { IsSuccess = true })); } else { return(View()); } }
/// <summary> /// 通过Sql语句增加一条学生记录 /// </summary> /// <param name="stu"></param> /// <returns></returns> public int AddStudent(Student stu) { return(studentDAL.AddStudent(stu)); }
public JsonResult Add(Student student) { return(Json(_student.AddStudent(student), JsonRequestBehavior.AllowGet)); }
public IActionResult Add(Student std) { _stud.AddStudent(std); return(RedirectToAction("Index")); }
public IHttpActionResult Post([FromBody] AddEditStudentDto Model) { Model.UserId = USER_ID; return(Ok(_repo.AddStudent(Model))); }
public void AddStudent(DomainModel.BusinessObject.Student student) { studentRepo.AddStudent(student); }