Exemple #1
0
        /// <summary>
        /// Gets the model with the specified id.
        /// </summary>
        /// <param name="id">The unique id</param>
        /// <returns>The model</returns>
        public async Task <ContentType> GetByIdAsync(string id)
        {
            if (_cache != null && App.CacheLevel != CacheLevel.None)
            {
                var types = await GetTypes().ConfigureAwait(false);

                return(types.FirstOrDefault(t => t.Id == id));
            }
            else
            {
                return(await _repo.GetById(id).ConfigureAwait(false));
            }
        }
Exemple #2
0
        public GetContentTypeResponse Get(Guid id)
        {
            IContentTypeRepository repo      = IoC.Container.Resolve <IContentTypeRepository>();
            GetContentTypeResponse response  = repo.GetById <GetContentTypeResponse>(id.ToString());
            IParameterRepository   paramRepo = IoC.Container.Resolve <IParameterRepository>();

            response.Parameters = paramRepo.GetByParentId(id, ParameterParentType.ContentType);
            return(response);
        }
Exemple #3
0
 public void Update(UpdateContentTypeRequest request)
 {
     this.ValidateUpdateRequest(request);
     using (IUnitOfWork uow = new UnitOfWork(RepositoryType.MSSQL))
     {
         IContentTypeRepository repo        = IoC.Container.Resolve <IContentTypeRepository>(uow);
         ContentType            contentType = repo.GetById(request.Id.ToString());
         contentType.Name        = request.Name;
         contentType.Key         = request.Key;
         contentType.Description = request.Description;
         this.UpdateParameters(contentType.Id, request.Parameters, uow);
         repo.Update(contentType);
         uow.Commit();
     }
 }