Ejemplo n.º 1
0
        public ActionResult Addagentslot(FormCollection collection)
        {
            try
            {
                // TODO: Add insert logic here

                tb_freeslot addinfreeS = new tb_freeslot();
                tb_agent    addslot    = new tb_agent();
                addinfreeS.agentinfree_name = collection["aname"].ToString();
                addinfreeS.Lat_infree       = collection["lat"];
                addinfreeS.Long_infree      = collection["long"];
                addinfreeS.sllotinfree_name = collection["sname"].ToString();
                //addslot.slot_name = collection["sname"];
                //db.tb_agent.Add(addslot);
                db.tb_freeslot.Add(addinfreeS);
                int j = db.SaveChanges();
                if (j > 0)
                {
                    ViewBag.s = "success";
                    return(View());
                }
                else
                {
                    ViewBag.s = "failed";
                    return(View());
                }
            }
            catch
            {
                return(View());
            }
        }
Ejemplo n.º 2
0
 public ActionResult Updatefreeslots(int id, FormCollection collection)
 {
     try
     {
         // id = Convert.ToInt32(collection["id"]);
         tb_freeslot getslots = db.tb_freeslot.Where(im => im.freeslot_id == id).FirstOrDefault();
         getslots.car_freeslot  = Convert.ToInt32(collection["car"]);
         getslots.bike_freeslot = Convert.ToInt32(collection["bike"]);
         int i = db.SaveChanges();
         if (i > 0)
         {
             ViewBag.s = "success";
             return(RedirectToAction("Freeslots"));
         }
         else
         {
             ViewBag.f = "failed";
             return(View());
         }
     }
     catch
     {
         return(View());
     }
 }