Example #1
0
        public ActionResult Create()
        {
            List <SponsorItem> lst        = new List <SponsorItem>();
            SponsorService     objService = new SponsorService();
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            lst = objService.getSponsorData(cid);
            SponsorItem objModel = new SponsorItem();

            objModel.ListSponsor = new List <SponsorItem>();
            objModel.ListSponsor.AddRange(lst);

            List <CompanyItem> lstCompany = new List <CompanyItem>();

            lstCompany           = objService.GetCompany();
            objModel.ListCompany = new List <CompanyItem>();
            objModel.ListCompany.AddRange(lstCompany);

            VehicleMasterService objVehicle = new VehicleMasterService();

            #region Bind DropDown Branch
            List <BranchItem> lstBranch = new List <BranchItem>();
            lstBranch           = objVehicle.GetBranch();
            objModel.ListBranch = new List <BranchItem>();
            objModel.ListBranch.AddRange(lstBranch);

            #endregion

            ViewBag.Menuid = Request.QueryString["menuId"];
            return(View(objModel));
        }
Example #2
0
        public ActionResult View(int id)
        {
            SponsorService objAppointService = new SponsorService();
            SponsorItem    objAItem          = new SponsorItem();

            objAItem = objAppointService.GetById(id);
            //Session["Empid"] = objPassItem.EmpId;
            List <SponsorItem> lstAppoint = new List <SponsorItem>();

            objAItem.ListSponsor = new List <SponsorItem>();
            objAItem.ListSponsor.AddRange(lstAppoint);
            ViewBag.Menuid = Request.QueryString["menuId"];

            List <CompanyItem> lstCompany = new List <CompanyItem>();

            lstCompany           = objAppointService.GetCompany();
            objAItem.ListCompany = new List <CompanyItem>();
            objAItem.ListCompany.AddRange(lstCompany);

            VehicleMasterService objVehicle = new VehicleMasterService();

            #region Bind DropDown Branch
            List <BranchItem> lstBranch = new List <BranchItem>();
            lstBranch           = objVehicle.GetBranch();
            objAItem.ListBranch = new List <BranchItem>();
            objAItem.ListBranch.AddRange(lstBranch);
            #endregion
            return(View(objAItem));
        }
Example #3
0
        public SponsorItem GetById(int id)
        {
            Mapper.CreateMap <SponsorMaster, SponsorItem>();
            SponsorMaster objAppoint     = DbContext.SponsorMasters.SingleOrDefault(m => m.SID == id);
            SponsorItem   objAppointItem = Mapper.Map <SponsorItem>(objAppoint);

            return(objAppointItem);
        }
Example #4
0
        public int Update(SponsorItem model)
        {
            Mapper.CreateMap <SponsorItem, SponsorMaster>();
            SponsorMaster objAppoint = DbContext.SponsorMasters.SingleOrDefault(m => m.SID == model.SID);

            objAppoint = Mapper.Map(model, objAppoint);
            return(DbContext.SaveChanges());
        }
Example #5
0
        public ActionResult Edit(SponsorItem model)
        {
            //    int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
            //model.EmpID = Empid;
            SponsorService objAppoint = new SponsorService();

            objAppoint.Update(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
Example #6
0
 public int Insert(SponsorItem model)
 {
     try
     {
         Mapper.CreateMap <SponsorItem, SponsorMaster>();
         SponsorMaster objAppoint = Mapper.Map <SponsorMaster>(model);
         DbContext.SponsorMasters.Add(objAppoint);
         return(DbContext.SaveChanges());
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Example #7
0
        public ActionResult Create(SponsorItem model)
        {
            SponsorService objService = new SponsorService();

            model.Status = 1;
            int cid = 0;

            if (Session["CompID"] != null)
            {
                cid = Convert.ToInt32(Session["CompID"].ToString());
            }
            if (model.CompID == null)
            {
                model.CompID = cid;
            }

            objService.Insert(model);
            return(RedirectToAction("Create", new { @menuId = model.Viewbagidformenu }));
        }
Example #8
0
 public ActionResult delete(int id, int menuid)
 {
     try
     {
         //int Empid = Convert.ToInt32(Url.RequestContext.RouteData.Values["id"].ToString());
         SponsorService objService = new SponsorService();
         SponsorItem    objDoc     = new SponsorItem();
         objDoc = objService.GetById(id);
         db.CredentialMasters.Remove(db.CredentialMasters.Find(id));
         db.SaveChanges();
         //ViewBag.Empid = Empid;
         ViewBag.Menuid = Request.QueryString["menuId"];
     }
     catch (Exception ex)
     {
         //ViewBag.ErrorMsg = "First Delete This Tenancy No's All Documents. ";
         return(View("Error"));
     }
     return(RedirectToAction("Create", new { @id = id, @menuId = Request.QueryString["menuId"] }));
 }