public LandConcession Add(LandConcession LCC, string userid)
        {
            var sqlQuery = @"INSERT INTO LANDCONCESSION (IDCONCESSION, CONCESSIONNAME, PERMISSIONNO, PERMISSIONTYPE, PERMISSIONDATE, STARTDATE, ENDDATE, COUNTRY, PROVINCE, CITY, HECTARAGE, COMPANYSITE, INPUTBY, INPUTDATE, UPDATEBY, UPDATEDATE) VALUES
                           ('" + LCC.IDCONCESSION + @"', '" + LCC.CONCESSIONNAME + "', '" + LCC.PERMISSIONNO + @"','" + LCC.PERMISSIONTYPE + @"', '" + LCC.PERMISSIONDATE + @"', '" + LCC.STARTDATE + @"', '" + LCC.ENDDATE + @"', '" + LCC.COUNTRY + @"', '" + LCC.PROVINCE + @"', '" + LCC.CITY + @"', '" + LCC.HECTARAGE + @"', '" + LCC.COMPANYSITE + @"'," + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"', " + Convert.ToInt32(userid) + ", '" + DateTime.Now + @"'); " + "SELECT CAST(SCOPE_IDENTITY() as int)";
            var SID      = _db.Query <int>(sqlQuery, LCC).Single();

            LCC.SID = SID;
            return(LCC);
        }
        public LandConcession Update(LandConcession LCC, string userid)
        {
            var sqlQuery =
                string.Format(@"UPDATE LANDCONCESSION SET CONCESSIONNAME = '{0}', PERMISSIONNO = '{1}', PERMISSIONTYPE = '{2}', PERMISSIONDATE = '{3}', STARTDATE = '{4}', ENDDATE = '{5}', COUNTRY = '{6}', PROVINCE = '{7}', CITY = '{8}', HECTARAGE = '{9}', COMPANYSITE = '{10}', UPDATEBY = {11}, UPDATEDATE = '{12}' WHERE SID = {13}",
                              LCC.CONCESSIONNAME, LCC.PERMISSIONNO, LCC.PERMISSIONTYPE, LCC.PERMISSIONDATE, LCC.STARTDATE, LCC.ENDDATE, LCC.COUNTRY, LCC.PROVINCE, LCC.CITY, LCC.HECTARAGE, LCC.COMPANYSITE, Convert.ToInt32(userid), DateTime.Now, LCC.SID);

            this._db.Execute(sqlQuery, LCC);
            return(LCC);
        }
        //
        // GET: /LandConcession/Create
        public ActionResult Create()
        {
            var model = new LandConcession();

            model.GetSelectListPermissionType = GetSelectListPermissionType();
            model.GetSelectListCountry        = GetSelectListCountry();
            model.GetSelectListProvince       = GetSelectListProvince();
            model.GetSelectListCity           = GetSelectListCity();
            return(View(model));
        }
 public ActionResult Edit(LandConcession LandConcession)
 {
     if (ModelState.IsValid)
     {
         LandConcession.COMPANYSITE = int.Parse(Session["companysite"].ToString());
         LCC.Update(LandConcession, Session["userid"].ToString());
         TempData["successmessage"] = "Saved successfully";
         return(RedirectToAction("Index"));
     }
     else
     {
         LandConcession.GetSelectListPermissionType = GetSelectListPermissionType();
         LandConcession.GetSelectListCountry        = GetSelectListCountry();
         LandConcession.GetSelectListProvince       = GetSelectListProvince();
         LandConcession.GetSelectListCity           = GetSelectListCity();
         return(View(LandConcession));
     }
 }