예제 #1
0
        protected void ucIList_InstanceRowSaving(object sender, InstanceRowSavingEventArgs e)
        {
            using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
            {
                EmployeeDto    project = e.Instance as EmployeeDto;
                EmployeeFacade facade  = new EmployeeFacade(uow);
                IFacadeUpdateResult <EmployeeData> result = facade.SaveEmployee(project);
                e.IsSuccessful = result.IsSuccessful;

                if (result.IsSuccessful)
                {
                    // Refresh whole list
                    RetrieveInstances(facade);
                }
                else
                {
                    // Deal with Update result
                    ProcUpdateResult(result.ValidationResult, result.Exception);
                }
            }
        }
예제 #2
0
        protected void ucIEdit_InstanceSaving(object sender, InstanceSavingEventArgs e)
        {
            EmployeeDto instance = e.Instance as EmployeeDto;

            if (instance != null)
            {
                using (IUnitOfWork uow = UnitOfWorkFactory.Instance.Start(DataStoreResolver.CRMDataStoreKey))
                {
                    EmployeeFacade facade = new EmployeeFacade(uow);
                    IFacadeUpdateResult <EmployeeData> result = facade.SaveEmployee(instance);
                    e.IsSuccessful = result.IsSuccessful;
                    if (result.IsSuccessful)
                    {
                        // Refresh Instance
                        CurrentInstance = result.ToDto <EmployeeDto>(new EmployeeConverter());
                    }
                    else
                    {
                        // Deal with Update result
                        ProcUpdateResult(result.ValidationResult, result.Exception);
                    }
                }
            }
        }
예제 #3
0
 public void Post([FromBody] Employee e)
 {
     empFac.SaveEmployee(e);
 }