Source

main-vinayFork / Source / WebClient / Web.BizLogic / Extensions / DocumentDetailExtension.cs

Full commit

using System;
using DataUp.Web.Common;
using DataUp.Web.DataLayer;

namespace DataUp.Web.BizLogic
{
    /// <summary>
    /// Extension for DocumentDetail object that represents a document.
    /// </summary>
    public static class DocumentDetailExtension
    {
        public static void SetValuesFrom(this DocumentDetail documentDetail, DocumentStore document)
        {
            if (documentDetail != null && document != null)
            {
                documentDetail.Id = document.Id;
                documentDetail.Citation = document.Citation;
                documentDetail.Description = document.Description;
                documentDetail.CreatedById = document.UserId;
                documentDetail.FileName = document.Filename;
                documentDetail.Identifier = document.Identifier;
                documentDetail.Metadata = document.Metadata;
                documentDetail.Title = document.Title;
                documentDetail.CreatedDateTime = document.UploadedDate;
                documentDetail.Status = document.Status.ToEnum<string, DocumentStatus>(DocumentStatus.Uploaded);

                documentDetail.Data = new DataDetail();
                documentDetail.Data.SetValuesFrom(document);
            }
        }
    }
}