예제 #1
0
 public DepartmentViewModel(DepartmentInfo info)
 {
     if (info == null) return;
     DepartmentID = info.DepartmentID;
     DepartmentName = info.DepartmentName;
     Description = info.Description;
 }
예제 #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);
            }
        }