public ResSectionEditViewModel(AppResourceSectionEntity resSection)
 {
     Name        = resSection.Name;
     Id          = resSection.Id;
     DateCreate  = resSection.DateCreate;
     Description = resSection.Description;
 }
Example #2
0
        /// <summary>
        /// Редактирует раздел ресурсов приложения.
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public AppResourceSectionEntity Edit(IAppResourceSectionModel model)
        {
            AppResourceSectionEntity entity = null;

            if (model.Id > 0)
            {
                entity = Sections.Find(model.Id);
                DbContext.Entry(entity).State = EntityState.Modified;
            }
            else
            {
                entity = new AppResourceSectionEntity();
                Sections.Add(entity);
            }

            entity.Name        = model.Name;
            entity.Description = model.Description;
            DbContext.SaveChanges();
            return(entity);
        }
Example #3
0
 /// <summary>
 /// DO NOT USE!!!
 /// </summary>
 /// <param name="editedInstance"></param>
 /// <returns></returns>
 public AppResourceSectionEntity Edit(AppResourceSectionEntity editedInstance)
 {
     throw new NotImplementedException();
 }