public async Task <IActionResult> Get() { //var x = await proxy.GetStudentsAsync(); ServiceReference1.Student newStudent = new ServiceReference1.Student() { StudentId = 0, FirstName = "cores", LastName = "cores", RegisterNo = "cores", Department = "cores" }; await proxy.AddStudentsAsync(newStudent); var x = await proxy.GetStudentsAsync(); return(Ok(x)); }
protected void InsertButton_Click(object sender, EventArgs e) { try { long StudentId = 0; if (txtStudentId.Text != null && txtStudentId.Text != string.Empty) { StudentId = Convert.ToInt64(txtStudentId.Text); } string FirstName = txtFirstName.Text.Trim(); string LastName = txtLastName.Text.Trim(); string RegisterNo = txtRegisterNo.Text.Trim(); string Department = txtDepartment.Text.Trim(); proxy = new ServiceReference1.Service1Client(); ServiceReference1.Student newStudent = new ServiceReference1.Student() { StudentId = StudentId, FirstName = FirstName, LastName = LastName, RegisterNo = RegisterNo, Department = Department }; proxy.AddStudents(newStudent); GridViewStudentDetails.DataSource = proxy.GetStudents(); GridViewStudentDetails.DataBind(); lblMsg.Text = "Record Saved Successfully"; } catch (FaultException<ExceptionMessage> exceptionFromService) { if (ButtonInsert.Visible == true) { lblMsg.Text = "Error while adding new customer details :" + exceptionFromService.Detail.errorMessageOfAction; } else { lblMsg.Text = "Error while updating customer details :" + exceptionFromService.Detail.errorMessageOfAction; } } catch (Exception exception) { if (ButtonInsert.Visible == true) { lblMsg.Text = "Error while adding new customer details :" + exception.Message; } else { lblMsg.Text = "Error while updating customer details :" + exception.Message; } } ResetAll(); }
public ActionResult Index() { var student = new ServiceReference1.Student() { StudentId = "D00638", Name = "La Phuong", BirthDay = DateTime.Now, Email = "*****@*****.**", Desciption = "meo dep trai", Gender = "Male" }; obj.Add(student); return(View()); }
public ActionResult Contact() { ViewBag.Message = "Your contact page."; var student = new ServiceReference1.Student() { StudentId = "D00636", Name = "meomeo", BirthDay = DateTime.Now, Email = "*****@*****.**", Desciption = "meo dep trai", Gender = "Male" }; obj.Update(student.StudentId, student.Name, student.BirthDay, student.Gender, student.Email, student.Desciption); return(View()); }
protected void btn_uredi_Click(object sender, EventArgs e) { bool uspesnost = false; int id = int.Parse(TextBox1.Text); int emso = int.Parse(TextBox2.Text); string ime = TextBox3.Text; string priimek = TextBox4.Text; int letoRojstva = int.Parse(TextBox5.Text); ServiceReference1.Student student = new ServiceReference1.Student(); student.Id = id; student.Emso = emso; student.Ime = ime; student.Priimek = priimek; student.LetoRojstva = letoRojstva; if (id.ToString() != "" && emso.ToString() != "" && ime != "" && priimek != "" && letoRojstva.ToString() != "") { uspesnost = StudentskiDomovi.UrediStudenta(student.Id, student.Emso, student.Ime, student.Priimek, student.LetoRojstva); } if (uspesnost == true) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Uspešno dodano!');", true); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; } else { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Prišlo je do napake!');", true); TextBox1.Text = ""; TextBox2.Text = ""; TextBox3.Text = ""; TextBox4.Text = ""; TextBox5.Text = ""; } }
protected void button_potrdi_Click(object sender, EventArgs e) { bool uspesnost = false; int id = int.Parse(textid.Text); int emso = int.Parse(textemso.Text); string ime = textime.Text; string priimek = textpriimek.Text; int letoRojstva = int.Parse(textletorojstva.Text); ServiceReference1.Student student = new ServiceReference1.Student(); student.Id = id; student.Emso = emso; student.Ime = ime; student.Priimek = priimek; student.LetoRojstva = letoRojstva; if (id.ToString() != "" && emso.ToString() != "" && ime != "" && priimek != "" && letoRojstva.ToString() != "") { uspesnost = StudentskiDomovi.DodajStudenta(student); } if (uspesnost == true) { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Uspešno dodano!');", true); textid.Text = ""; textemso.Text = ""; textime.Text = ""; textpriimek.Text = ""; textletorojstva.Text = ""; } else { ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('Prišlo je do napake!');", true); textid.Text = ""; textemso.Text = ""; textime.Text = ""; textpriimek.Text = ""; textletorojstva.Text = ""; } }
public System.Threading.Tasks.Task AddStudentsAsync(ServiceReference1.Student student) { return(base.Channel.AddStudentsAsync(student)); }