当前位置: 首页>>代码示例>>C#>>正文


C# Employee.IsValid方法代码示例

本文整理汇总了C#中Employee.IsValid方法的典型用法代码示例。如果您正苦于以下问题:C# Employee.IsValid方法的具体用法?C# Employee.IsValid怎么用?C# Employee.IsValid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Employee的用法示例。


在下文中一共展示了Employee.IsValid方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: given_employee_with_firstname_when_checking_isvalid_should_be_true

 public void given_employee_with_firstname_when_checking_isvalid_should_be_true()
 {
     var employee = new Employee { FirstName = "Todd" };
     employee.IsValid()
         .Should()
         .BeTrue();
 }
开发者ID:toddmeinershagen,项目名称:Demo.Domain,代码行数:7,代码来源:EmployeeTests.cs

示例2: given_employee_without_firstname_when_checking_isvalid_should_be_false

 public void given_employee_without_firstname_when_checking_isvalid_should_be_false()
 {
     var employee = new Employee();
     employee.IsValid()
         .Should()
         .BeFalse();
 }
开发者ID:toddmeinershagen,项目名称:Demo.Domain,代码行数:7,代码来源:EmployeeTests.cs

示例3: Create

        [AcceptVerbs(HttpVerbs.Post)]   // Limits the method to only accept post requests
        public ActionResult Create(Employee employee) {
            if (ViewData.ModelState.IsValid && employee.IsValid()) {
                employeeRepository.SaveOrUpdate(employee);

                TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] = 
					"The employee was successfully created.";
                return RedirectToAction("Index");
            }

            EmployeeFormViewModel viewModel = EmployeeFormViewModel.CreateEmployeeFormViewModel(territoriesRepository);
            viewModel.Employee = employee;
            return View(viewModel);
        }
开发者ID:EdisonCP,项目名称:sharp-architecture,代码行数:14,代码来源:EmployeesController.cs

示例4: Edit

        public ActionResult Edit(Employee employee) {
            Employee employeeToUpdate = employeeRepository.Get(employee.Id);
            TransferFormValuesTo(employeeToUpdate, employee);

            if (ViewData.ModelState.IsValid && employee.IsValid()) {
                TempData[ControllerEnums.GlobalViewDataProperty.PageMessage.ToString()] = 
					"The employee was successfully updated.";
                return RedirectToAction("Index");
            }
            else {
                employeeRepository.DbContext.RollbackTransaction();

                EmployeeFormViewModel viewModel = EmployeeFormViewModel.CreateEmployeeFormViewModel(territoriesRepository);
				viewModel.Employee = employee;
				return View(viewModel);
            }
        }
开发者ID:EdisonCP,项目名称:sharp-architecture,代码行数:17,代码来源:EmployeesController.cs


注:本文中的Employee.IsValid方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。