Beispiel #1
0
        public ActionResult DeleteConfirmed(long id)
        {
            Registraion registraion = db.Registraions.Find(id);

            db.Registraions.Remove(registraion);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Beispiel #2
0
 public ActionResult Edit([Bind(Include = "RegistraionID,FullName,EmailID,MobileNo,Gender,Hobbies,DateOfBirth,CountryID,StateID,City")] Registraion registraion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(registraion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(registraion));
 }
Beispiel #3
0
        public void ShouldThrow()
        {
            var repository   = new MemoryRepository <Car>();
            var registration = new Registraion {
                Number = "abc"
            };
            var car = new Car(registration);

            repository.Save(car);

            // NOTE (Cameron): This should throw because we're trying to load an aggregate with a natural key of type string using a value object.
            Assert.Throws <ArgumentException>(() => repository.Load(registration));
        }
Beispiel #4
0
        // GET: Registraions/Details/5
        public ActionResult Details(long?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Registraion registraion = db.Registraions.Find(id);

            if (registraion == null)
            {
                return(HttpNotFound());
            }
            return(View(registraion));
        }
Beispiel #5
0
            public Car(Registraion registration)
            {
                Guard.Against.Null(() => registration);

                this.RegistrationNumber = registration.Number;
            }
Beispiel #6
0
 partial void DeleteRegistraion(Registraion instance);
Beispiel #7
0
 partial void UpdateRegistraion(Registraion instance);
Beispiel #8
0
 partial void InsertRegistraion(Registraion instance);
Beispiel #9
0
        // GET: Registraions/Edit/5
        public ActionResult Edit(long?id)
        {
            string        countrystring = "select C.CountryID,C.CountryName from Registraion R Inner join Country C ON C.CountryID = R.CountryID where RegistraionID =" + id + "";
            DataSet       ds            = new DataSet();
            List <string> li            = new List <string>();
            DataTable     dt            = new DataTable();

            dt = objdal.MyMethod(countrystring);
            List <SelectListItem> list = new List <SelectListItem>();

            foreach (DataRow row in dt.Rows)
            {
                list.Add(new SelectListItem {
                    Text = Convert.ToString(row.ItemArray[1]), Value = Convert.ToString(row.ItemArray[0])
                });
            }
            ViewBag.CountryID = new SelectList(db.Countries, "CountryID", "CountryName");

            string        Statestring = "select S.StateID,S.StateName from Registraion R Inner join State S ON S.StateID = R.StateID where RegistraionID  =" + id + "";
            DataSet       StatedDS    = new DataSet();
            List <string> Liststate   = new List <string>();
            DataTable     Statedt     = new DataTable();

            Statedt = objdal.MyMethod(Statestring);
            List <SelectListItem> Statelist = new List <SelectListItem>();

            foreach (DataRow row in Statedt.Rows)
            {
                Statelist.Add(new SelectListItem {
                    Value = Convert.ToString(row.ItemArray[0]), Text = Convert.ToString(row.ItemArray[1])
                });
            }
            ViewBag.StateID = new SelectList(db.States, "StateID", "StateName");

            string        Citytring = "select C.CityID,C.CityName from Registraion R Inner join City C ON C.CityID = R.City where RegistraionID  =" + id + "";
            DataSet       CitydDS   = new DataSet();
            List <string> Listcity  = new List <string>();
            DataTable     Citydt    = new DataTable();

            Citydt = objdal.MyMethod(Citytring);
            List <SelectListItem> Citylist = new List <SelectListItem>();

            foreach (DataRow row in Citydt.Rows)
            {
                Citylist.Add(new SelectListItem {
                    Value = Convert.ToString(row.ItemArray[0]), Text = Convert.ToString(row.ItemArray[1])
                });
            }
            ViewBag.City = new SelectList(db.Cities, "CityID", "CityName");

            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Registraion registraion = db.Registraions.Find(id);

            if (registraion == null)
            {
                return(HttpNotFound());
            }
            return(View(registraion));
        }