コード例 #1
0
 public ActionResult Create()
 {
     var model = new AgentCreateViewModel
     {
         newAgent = new Agent(),
         agentStates = AgentStateBUS.GetList()
     };
     return View(model);
 }
コード例 #2
0
        public ActionResult Create(AgentCreateViewModel model)
        {
            Agent newAgent = new Agent();
            newAgent.Username = model.newAgent.Username;
            newAgent.Password = model.newAgent.Password;
            newAgent.StatusId = model.newAgent.StatusId;
            newAgent.FistName = model.newAgent.FistName;
            newAgent.LastName = model.newAgent.LastName;
            newAgent.Address = model.newAgent.Address;
            newAgent.Phone = model.newAgent.Phone;
            newAgent.Email = model.newAgent.Email;
            newAgent.Comment = model.newAgent.Comment;

            bool bSuccess = AgentBUS.AdđItem(newAgent);

            if (bSuccess == true)
                return RedirectToAction("Browse");

            return View(model);
        }