Ejemplo n.º 1
0
 public YearDto Save(YearDto dto)
 {
     try
     {
         var retVal = this.dal.Save(dto.Id, dto.Year).ToDto();
         return(retVal);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 2
0
        //#region .: SubCategory1 :.
        //public static SubCategory1Dto ToDto(this DataAccess.Models.SubCategory1 item)
        //{
        //    SubCategory1Dto dto = null;

        //    if (item != null)
        //    {
        //        dto = new SubCategory1Dto
        //        {
        //            Id = item.Id,
        //            Name = item.Name,
        //            Category = new CategoryDto(),
        //            SubCategories2 = new List<SubCategory2Dto>()
        //        };
        //    }

        //    if (item.Category != null)
        //    {
        //        dto.Category.Id = item.Category.Id;
        //        dto.Category.Name = item.Category.Name;
        //    }

        //    return dto;
        //}

        //public static List<SubCategory1Dto> ToDto(this List<DataAccess.Models.SubCategory1> collection)
        //{
        //    var dtos = new List<SubCategory1Dto>();

        //    if (collection != null)
        //    {
        //        collection.ForEach(s => dtos.Add(s.ToDto()));
        //    }

        //    return dtos;
        //}

        //public static SubCategory1FlatDto ToFlatDto(this DataAccess.Models.SubCategory1 item)
        //{
        //    SubCategory1FlatDto dto = null;

        //    if (item != null)
        //    {
        //        dto = new SubCategory1FlatDto
        //        {
        //            Id = item.Id,
        //            Name = item.Name
        //        };

        //        if (item.Category != null)
        //        {
        //            dto.CategoryId = item.Category.Id;
        //            dto.CategoryName = item.Category.Name;
        //        }
        //    }

        //    return dto;
        //}

        //public static List<SubCategory1FlatDto> ToFlatDto(this List<DataAccess.Models.SubCategory1> collection)
        //{
        //    var dtos = new List<SubCategory1FlatDto>();

        //    if (collection != null)
        //    {
        //        collection.ForEach(c => dtos.Add(c.ToFlatDto()));
        //    }

        //    return dtos;
        //}
        //#endregion

        //#region .: SubCategory2 :.
        //public static SubCategory2Dto ToDto(this DataAccess.Models.SubCategory2 item)
        //{
        //    SubCategory2Dto dto = null;

        //    if (item != null)
        //    {
        //        dto = new SubCategory2Dto
        //        {
        //            Id = item.Id,
        //            Name = item.Name,
        //            SubCategory1 = new SubCategory1Dto { Id = item.SubCategory1Id, Name = item.SubCategory1.Name }
        //        };
        //    }

        //    if (item.SubCategory1 != null)
        //    {
        //        item.SubCategory1.Id = item.SubCategory1.Id;
        //        item.SubCategory1.Name = item.SubCategory1.Name;
        //    }

        //    return dto;
        //}

        //public static List<SubCategory2Dto> ToDto(this List<DataAccess.Models.SubCategory2> collection)
        //{
        //    var dtos = new List<SubCategory2Dto>();

        //    if (collection != null)
        //    {
        //        collection.ForEach(s => dtos.Add(s.ToDto()));
        //    }

        //    return dtos;
        //}
        //#endregion

        #region .: Year :.
        public static YearDto ToDto(this DataAccess.Models.Year item)
        {
            YearDto dto = null;

            if (item != null)
            {
                dto = new YearDto
                {
                    Id   = item.Id,
                    Year = item.Year1.HasValue ? item.Year1.Value : Convert.ToInt16(0)
                };
            }

            return(dto);
        }
Ejemplo n.º 3
0
 public YearDto SaveYear(YearDto dto)
 {
     return(new YearLogic().Save(dto));
 }
Ejemplo n.º 4
0
 public YearDto CreateYear(YearDto dto)
 {
     return(new YearLogic().Create(dto));
 }