コード例 #1
0
        // Create
        public CreateNewNotificationTypesResponse CreateNewNotificationType(CreateNewNotificationTypesRequest request)
        {
            var response = new CreateNewNotificationTypesResponse();
            try
            {
                Guard.ArgNotNull(_unitOfWork.NotificationTypeRepository, "_notificationType");

                var notificationType = new NotificationType
                                           {
                                               Name = request.Name,
                                               Description = request.Description
                                           };
                _unitOfWork.NotificationTypeRepository.Insert(notificationType);
                _unitOfWork.Save();

                int newId = notificationType.Id;
                if (newId > 0)
                {
                    response.Success = true;
                    response.Id = newId;
                    response.Name = notificationType.Name;
                    response.Description = notificationType.Description;
                    Logger.LogInfo("Successfully created NotificationType Id: " + newId.ToString(), LogType.General);
                }
            }
            catch (Exception ex)
            {
                response.Success = false;
                response.FailureInformation = ex.Message;
                Logger.LogError("CreateNewNotificationType Method Failed", ex);
            }

            return response;
        }
コード例 #2
0
 /// <summary>
 /// Deprecated Method for adding a new object to the NotificationTypes EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToNotificationTypes(NotificationType notificationType)
 {
     base.AddObject("NotificationTypes", notificationType);
 }
コード例 #3
0
 /// <summary>
 /// Create a new NotificationType object.
 /// </summary>
 /// <param name="id">Initial value of the Id property.</param>
 /// <param name="name">Initial value of the Name property.</param>
 /// <param name="description">Initial value of the Description property.</param>
 public static NotificationType CreateNotificationType(global::System.Int32 id, global::System.String name, global::System.String description)
 {
     NotificationType notificationType = new NotificationType();
     notificationType.Id = id;
     notificationType.Name = name;
     notificationType.Description = description;
     return notificationType;
 }