// 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; }
/// <summary> /// Deprecated Method for adding a new object to the NotificationTypes EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToNotificationTypes(NotificationType notificationType) { base.AddObject("NotificationTypes", notificationType); }
/// <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; }