コード例 #1
0
        public ActionResult Create(FormCollection formCollection)
        {
            //  try
            //  {
            ElevatorBusiness ElevatorBusiness = new ElevatorBusiness(new ElevatorDataAccess());
            LookupBusiness   lookupBusiness   = new LookupBusiness(new LookupDataAccess());

            ElevatorCoreModel.Elevator elevator = new ElevatorCoreModel.Elevator
            {
                CreatedByUserId  = 1, // (int)Session["ElevatorId"];
                ModifiedByUserId = 2, // (int)Session["ElevatorId"];
                ElevatorName     = formCollection["ElevatorName"],
                FloorDuration    = Convert.ToInt32(formCollection["FloorDuration"]),
                MaxWeight        = Convert.ToInt32(formCollection["MaxWeight"]),
                CreatedDate      = DateTime.Now,
                ModifiedDate     = DateTime.Now,
                MainStatusId     = lookupBusiness.GetLookupId("MainStatus", formCollection["MainStatus"]),
            };
            ElevatorBusiness.Create(elevator);
            return(RedirectToAction("Index"));
            //}
            //catch
            //{
            //    return View();
            //}
        }
コード例 #2
0
        public ActionResult Create(FormCollection formCollection)
        {
            //  try
            //  {
            UserBusiness   userBusiness   = new UserBusiness(new UserDataAccess());
            LookupBusiness lookupBusiness = new LookupBusiness(new LookupDataAccess());
            User           user           = new User
            {
                CreatedByUserId  = 1, // (int)Session["UserId"];
                ModifiedByUserId = 2, // (int)Session["UserId"];
                Address          = formCollection["Address"],
                EmailId          = formCollection["EmailId"],
                FirstName        = formCollection["FirstName"],
                LastName         = formCollection["LastName"],
                CreatedDate      = DateTime.Now,
                ModifiedDate     = DateTime.Now,
                DateOfBirth      = DateTime.Now,
                GenderId         = lookupBusiness.GetLookupId("Gender", formCollection["Gender"]),
                Password         = formCollection["Password"]
            };

            userBusiness.Create(user);
            return(RedirectToAction("Index"));
            //}
            //catch
            //{
            //    return View();
            //}
        }