本文整理汇总了C#中DataContract.ToDomainModel方法的典型用法代码示例。如果您正苦于以下问题:C# DataContract.ToDomainModel方法的具体用法?C# DataContract.ToDomainModel怎么用?C# DataContract.ToDomainModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataContract
的用法示例。
在下文中一共展示了DataContract.ToDomainModel方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Create
public DataContract.EmployeeResponse Create(DataContract.Employee employee)
{
EmployeeResponse response = new EmployeeResponse();
try
{
employee.JoiningDate = DateTime.UtcNow;
var result = _manager.Create(employee.ToDomainModel());
if (result == null)
{
response.Status.StatusCode = "500";
response.Status.Message = "Error in creating employee";
return response;
}
response.Employee = result.ToDataContract();
return response;
}
catch (Exception ex)
{
ExceptionPolicy.HandleException("service.policy", ex);
response.Status.StatusCode = "500";
response.Status.Message = "Error in creating Employee";
return response;
}
}
示例2: AddRemark
public DataContract.RemarkResponse AddRemark(string employeeId, DataContract.Remark remark)
{
RemarkResponse response = new RemarkResponse();
try
{
var result = _manager.AddRemark(employeeId, remark.ToDomainModel());
if (result == null)
{
response.Status.StatusCode = "500";
response.Status.Message = "Error in creating employee";
return response;
}
response.Remark = result.ToDataContract();
return response;
}
catch (Exception ex)
{
ExceptionPolicy.HandleException("service.policy", ex);
response.Status.StatusCode = "500";
response.Status.Message = "Error in creating Employee";
return response;
}
}
示例3: Create
public DataContract.Employee Create(DataContract.Employee employee)
{
try
{
var result = _manager.Create(employee.ToDomainModel());
if (result == null) return null;
return result.ToDataContract();
}
catch (Exception ex)
{
Exception newEx;
var rethrow = ExceptionPolicy.HandleException("service.policy", ex, out newEx);
throw newEx;
}
}
示例4: AddRemark
public DataContract.Remark AddRemark(string employeeId, DataContract.Remark remark)
{
try
{
var result = _manager.AddRemark(employeeId, remark.ToDomainModel());
if (result == null) return null;
return result.ToDataContract();
}
catch (Exception ex)
{
Exception newEx;
var rethrow = ExceptionPolicy.HandleException("service.policy", ex, out newEx);
throw newEx;
}
}
示例5: Authenticate
public DataContract.Employee Authenticate(DataContract.Credential credential)
{
try
{
var result = _manager.Authenticate(credential.ToDomainModel());
if (result == null) return null;
return result.ToDataContract();
}
catch (Exception ex)
{
var rethrow = ExceptionPolicy.HandleException("service.policy", ex);
if (rethrow) throw;
return null;
}
}