Ejemplo n.º 1
0
        private async Task <BaseResult> Create(CategoryLecture categoryLecture)
        {
            var result = new BaseResult();

            var exist = CategoryLectureRepository.QueryAll().FirstOrDefault(
                x => x.CategoryId == categoryLecture.CategoryId &&
                x.LectureId == categoryLecture.LectureId);

            if (exist != null)
            {
                try
                {
                    exist.IsDeleted = false;
                    await CategoryLectureRepository.UpdateAsync(exist);
                }
                catch (Exception e)
                {
                    result.Result  = Result.SystemError;
                    result.Message = e.ToString();
                }
            }
            else
            {
                try
                {
                    await CategoryLectureRepository.InsertAsync(categoryLecture);
                }
                catch (Exception e)
                {
                    result.Result  = Result.SystemError;
                    result.Message = e.ToString();
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
 public static CategoryLectureItem ToItem(this CategoryLecture entity)
 {
     return(entity.MapTo <CategoryLecture, CategoryLectureItem>());
 }
Ejemplo n.º 3
0
 public static CategoryLecture ToCategoryLecture(this CategoryLecture entity, CategoryLecture destination)
 {
     return(entity.MapTo(destination));
 }
Ejemplo n.º 4
0
 public static CategoryLectureModel ToModel(this CategoryLecture entity)
 {
     return(entity.MapTo <CategoryLecture, CategoryLectureModel>());
 }