コード例 #1
0
        public dynamic GetInfo(int Id)
        {
            BranchOffice model = new BranchOffice();

            try
            {
                model = _branchOfficeService.GetObjectById(Id);
            }
            catch (Exception ex)
            {
                LOG.Error("GetInfo", ex);
                Dictionary <string, string> Errors = new Dictionary <string, string>();
                Errors.Add("Generic", "Error " + ex);

                return(Json(new
                {
                    Errors
                }, JsonRequestBehavior.AllowGet));
            }

            return(Json(new
            {
                model.Id,
                model.Code,
                model.Name,
                model.Address,
                model.City,
                model.PostalCode,
                model.PhoneNumber,
                model.FaxNumber,
                model.Email,
                model.Website,
                model.Errors
            }, JsonRequestBehavior.AllowGet));
        }
コード例 #2
0
        public Department VHasBranchOffice(Department department, IBranchOfficeService _branchOfficeService)
        {
            BranchOffice branchOffice = _branchOfficeService.GetObjectById(department.BranchOfficeId);

            if (branchOffice == null)
            {
                department.Errors.Add("Generic", "BranchOffice Tidak valid");
            }
            return(department);
        }