Ejemplo n.º 1
0
        /// <summary>
        /// Update existing reference.
        /// </summary>
        /// <param name="context">Web service request context.</param>
        /// <param name="reference">Existing reference to update.</param>
        public static void UpdateReference(WebServiceContext context,
                                           WebReference reference)
        {
            String userFullName;

            // Check access rights.
            WebServiceData.AuthorizationManager.CheckAuthorization(context, AuthorityIdentifier.EditReference);

            // Check data.
            context.CheckTransaction();
            reference.CheckData(context);

            // Update reference.
            if (context.GetUser().Type == UserType.Person)
            {
                userFullName = WebServiceData.UserManager.GetPerson(context).GetFullName();
            }
            else
            {
                userFullName = context.GetUser().UserName;
            }

            context.GetReferenceDatabase().UpdateReference(reference.Id,
                                                           reference.Name,
                                                           reference.Year,
                                                           reference.Title,
                                                           userFullName);
        }