コード例 #1
0
        public HttpResponseMessage UpdateDepartment(DepartmentViewModel department)
        {
            try
            {
                var objDepartmentInfo = DepartmentManager.Instance.GetDepartment(PortalSettings.PortalId, department.DepartmentID);
                objDepartmentInfo.DepartmentName = department.DepartmentName;
                objDepartmentInfo.Description = department.Description;
                objDepartmentInfo.TicketEnabled = department.TicketEnabled;
                objDepartmentInfo.LiveChatEnabled = department.LiveChatEnabled;
                DepartmentManager.Instance.UpdateDepartment(objDepartmentInfo);

                return Request.CreateResponse(HttpStatusCode.OK, new { Success = true });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
        }
コード例 #2
0
        public HttpResponseMessage AddDepartment(DepartmentViewModel department)
        {
            try
            {
                var objDepartmentInfo = new DepartmentInfo()
                {
                    PortalID = PortalSettings.PortalId,
                    DepartmentName = department.DepartmentName,
                    Description = department.Description,
                    TicketEnabled = department.TicketEnabled,
                    LiveChatEnabled = department.LiveChatEnabled,
                    CreateByUser = UserInfo.UserID,
                    CreateDate = DateTime.Now
                };
                int departmentID = DepartmentManager.Instance.AddDepartment(objDepartmentInfo);

                return Request.CreateResponse(HttpStatusCode.OK, new { Success = true, DepartmentID = departmentID });
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message);
            }
        }