예제 #1
0
        public ActionResult Create(FormCollection collection)
        {
            // TODO: Add insert logic here
            var v = new Contractor();

            UpdateModel(v);
            repo.Add(v);
            return(RedirectToAction("Index"));
        }
        public ActionResult Create(Contractor Contractor, string userid)
        {
            if (ModelState.IsValid)
            {
                if (Contractor.ISACTIVE)
                    Contractor.ISACTIVEDATE = DateTime.Now;

                Contractor.COMPANYSITE = int.Parse(Session["companysite"].ToString());
                CTR.Add(Contractor, Session["userid"].ToString());
                TempData["successmessage"] = "Saved successfully";
                return RedirectToAction("Create");
            }
            else
            {
                Contractor.GetSelectListContractorGroup = GetSelectListContractorGroup();
                Contractor.GetSelectListControlJob = GetSelectListControlJob();
                Contractor.GetSelectListBank = GetSelectListBank();
                Contractor.GetSelectListCountry = GetSelectListCountry();
                Contractor.GetSelectListProvince = GetSelectListProvince();
                Contractor.GetSelectListCity = GetSelectListCity();
                return View(Contractor);
            }
        }