public ActionResult Update(int id)
        {
            list = inter.Show_Record();
            XpayDetails s1 = list.FirstOrDefault(s => s.Id == id);

            return(View(s1));
        }
Beispiel #2
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            XpayDetails xp = new XpayDetails();

            xp.Id = Convert.ToInt32(TextBox1.Text);
            imp.Dlt_Record(xp);


            Button1_Click(sender, e);
        }
Beispiel #3
0
        public void Dlt_Record(XpayDetails xp)
        {
            SqlCommand com = new SqlCommand("XpayDeleteData", con);

            com.CommandType = CommandType.StoredProcedure;
            com.Parameters.AddWithValue("@Id", xp.Id);

            con.Open();
            com.ExecuteNonQuery();
            con.Close();
        }
        protected void Button1_Click(object sender, EventArgs e)
        {
            XpayDetails xp               = new XpayDetails();
            string      Name             = Convert.ToString(TextBox1.Text);
            decimal     Amount           = Convert.ToDecimal(TextBox2.Text);
            string      Description      = Convert.ToString(TextBox3.Text);
            string      TermAndCondition = Convert.ToString(TextBox4.Text);

            xp.Name             = Name;
            xp.Amount           = Amount;
            xp.Description      = Description;
            xp.TermAndCondition = TermAndCondition;
            imp.Insert_record(xp);
        }
Beispiel #5
0
        public void Update_Record(XpayDetails xp)
        {
            try
            {
                SqlCommand com = new SqlCommand("XpayUpdateData", con);
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.AddWithValue("@Id", xp.Id);
                com.Parameters.AddWithValue("@Name", xp.Name);
                com.Parameters.AddWithValue("@Amount", xp.Amount);
                com.Parameters.AddWithValue("@Description ", xp.Description);

                com.Parameters.AddWithValue("@TermAndCondition", xp.TermAndCondition);
                con.Open();
                com.ExecuteNonQuery();
                Console.WriteLine("Data Updated");
                con.Close();
            }
            catch (Exception e)
            {
                Console.Write(e);
            }
        }
 public ActionResult Update(XpayDetails xp)
 {
     inter.Update_Record(xp);
     return(RedirectToAction("index"));
 }
 public ActionResult Delete(XpayDetails xp)
 {
     inter.Dlt_Record(xp);
     return(RedirectToAction("index"));
 }
 public ActionResult Create(XpayDetails xp)
 {
     inter.Insert_record(xp);
     return(RedirectToAction("index"));
 }
Beispiel #9
0
        public static void Main()
        {
            InterfaceRepo empinterfece = new Implemantation();
            XpayDetails   xp           = new XpayDetails();

            Console.WriteLine("Enter 1:Insert \t 2:Delete \t 3: update\t 4: show:");
            int i = Convert.ToInt32(Console.ReadLine());

            if (i == 1)
            {
                Console.WriteLine("Id\t  Name\t  Amount\t  Description\t  TermAndCondition ");
                //  int Id = Convert.ToInt32(Console.ReadLine());
                string  Name             = Console.ReadLine();
                decimal Amount           = decimal.Parse(Console.ReadLine());
                string  Description      = Console.ReadLine();
                string  TermAndCondition = Console.ReadLine();

                //xp.Id=Id;
                xp.Name             = Name;
                xp.Amount           = Amount;
                xp.Description      = Description;
                xp.TermAndCondition = TermAndCondition;

                empinterfece.Insert_record(xp);


                Main();
            }
            if (i == 2)
            {
                Console.WriteLine("Enter id to dlt data");
                int id = Convert.ToInt32(Console.ReadLine());
                xp.Id = id;
                empinterfece.Dlt_Record(xp);
                Console.WriteLine("Datadeleted");
                Main();
            }

            if (i == 3)
            {
                Console.WriteLine("Id,Name,Amount,Description,TermAndCondition");
                Console.WriteLine("Insert Id to be updated");
                int     Id               = Convert.ToInt32(Console.ReadLine());
                string  Name             = Console.ReadLine();
                decimal Amount           = decimal.Parse(Console.ReadLine());
                string  Description      = Console.ReadLine();
                string  TermAndCondition = Console.ReadLine();

                xp.Id               = Id;
                xp.Name             = Name;
                xp.Amount           = Amount;
                xp.Description      = Description;
                xp.TermAndCondition = TermAndCondition;

                empinterfece.Update_Record(xp);


                Main();
            }
            if (i == 4)
            {
                List <XpayDetails> lst = new List <XpayDetails>();
                lst = empinterfece.Show_Record();
                foreach (var obj in lst)
                {
                    Console.WriteLine("id=" + obj.Id + ",name=" + obj.Name + " and num=" + obj.Amount + "Description= " + obj.Description + "Term and condition= " + obj.TermAndCondition);
                }
                Main();
            }

            Console.ReadLine();
        }