public ActionResult DeleteConfirmed(int id)
        {
            GeneralInfoParcel generalInfoParcel = db.GeneralInfoParcels.Find(id);

            db.GeneralInfoParcels.Remove(generalInfoParcel);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,ParcelNo,OwnerName,Ropani,Aana,Daam,Paisa,MapsheetNo,District,VDCMunicipality,Ward,LandSettingTypeValue,LandSettingTypeValue,sqmeter,TotalArea")] GeneralInfoParcel generalInfoParcel, [Bind(Include = "Id,LandSettingTypeId")] LandValuationScore landValuationScore)
 {
     if (ModelState.IsValid)
     {
         db.Entry(generalInfoParcel).State  = EntityState.Modified;
         db.Entry(landValuationScore).State = EntityState.Modified;
         return(RedirectToAction("Index"));
     }
     return(View(generalInfoParcel));
 }
        // GET: GeneralInfoParcels/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GeneralInfoParcel generalInfoParcel = db.GeneralInfoParcels.Find(id);

            if (generalInfoParcel == null)
            {
                return(HttpNotFound());
            }
            return(View(generalInfoParcel));
        }
        // GET: GeneralInfoParcels/Edit/5
        public ActionResult Edit(int?id, int?valid)
        {
            ViewBag.LandSettingID = db.LandSetting.ToList();
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GeneralInfoParcel  generalInfoParcel  = db.GeneralInfoParcels.Find(id);
            LandValuationScore landValuationScore = db.LandValuationScore.Where(x => x.landsettingvalueID == generalInfoParcel.Id).FirstOrDefault();

            if (generalInfoParcel == null)
            {
                return(HttpNotFound());
            }
            return(View(generalInfoParcel));
        }
        public ActionResult Create(GeneralInfoParcelViewModel generalInfoParcel)
        {
            if (ModelState.IsValid)
            {
                var generalIfo = new GeneralInfoParcel()
                {
                    MapsheetNo      = generalInfoParcel.MapsheetNo,
                    OwnerName       = generalInfoParcel.OwnerName,
                    Aana            = generalInfoParcel.Aana,
                    Daam            = generalInfoParcel.Daam,
                    District        = generalInfoParcel.District,
                    Paisa           = generalInfoParcel.Paisa,
                    ParcelNo        = generalInfoParcel.ParcelNo,
                    Ropani          = generalInfoParcel.Ropani,
                    VDCMunicipality = generalInfoParcel.VDCMunicipality,
                    Ward            = generalInfoParcel.Ward,
                    sqmeter         = generalInfoParcel.sqmeter,
                    TotalArea       = generalInfoParcel.TotalArea
                };
                var generaldatabase = db.GeneralInfoParcels.Add(generalIfo);
                db.SaveChanges();

                foreach (var type in generalInfoParcel.Types)
                {
                    string[] typedata  = type.Split(',');
                    var      landscore = new LandValuationScore()
                    {
                        GeneralinfoparcelID = generaldatabase.Id,
                        landsettingvalueID  = Convert.ToInt32(typedata[0])
                    };
                    db.LandValuationScore.Add(landscore);
                    db.SaveChanges();
                }

                return(RedirectToAction("Index"));
            }

            return(View(generalInfoParcel));
        }