Example #1
0
        /// <summary>
        /// Создать DTO из сущности
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public static CaseDto MapFromCaseEntity(Domain.Entities.Case entity)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new CaseDto
            {
                CaseId       = entity.Id,
                CaseFolderId = entity.CaseFolder.Id,
                Template     = entity.Type?.Data,
                Data         = entity.CaseFolder.Data,
                Css          = entity.Type?.Css,
                ActivatedPlanInstructions = entity.ActivatedPlanInstructions,
                Latitude   = entity.CaseFolder.Latitude,
                Longitude  = entity.CaseFolder.Longitude,
                CaseTypeId = entity.Type?.Id
            };

            return(dto);
        }
        /// <summary>
        /// Создать DTO из сущности
        /// </summary>
        public static CaseListItemDto MapFromCaseEntity(Domain.Entities.Case entity, string address, string applicant, string victim)
        {
            if (entity == null)
            {
                return(null);
            }

            var dto = new CaseListItemDto
            {
                Id           = entity.Id,
                CaseFolderId = entity.CaseFolder.Id,
                CreatedDate  = entity.Created,
                Address      = address,
                Applicant    = applicant,
                Victim       = victim,
                Index        = entity.IndexValue,
                State        = entity.Status,
                TypeTitle    = entity.Type.GetTitle(),
                TypeId       = entity.Type.Id
            };

            return(dto);
        }