Пример #1
0
 public ManualType GetModel()
 {
     var manualType = new ManualType
                          {
                              Title = Title,
                              Order = Order
                          };
     return manualType;
 }
Пример #2
0
        public static bool Update(DefaultContext db, ManualType manualType)
        {
            int manualTypeId = manualType.ManualTypeId;
            ManualType dbManualType = GetDetail(db, manualTypeId);
            if (dbManualType == null)
                return false;

            dbManualType.CopyFrom(manualType);

            db.SaveChanges();

            return true;
        }
Пример #3
0
        public static DeleteResult Delete(DefaultContext db, ManualType manualType)
        {
            if (manualType == null)
                return DeleteResult.AuthorizationFailed;

            try
            {
                db.ManualTypes.Remove(manualType);
                db.SaveChanges();

                return DeleteResult.Ok;
            }
            catch (Exception e)
            {
                Logger.SetLog(e);
                return DeleteResult.DbFailed;
            }
        }
Пример #4
0
 public void CopyFrom(ManualType manualType)
 {
     Title = manualType.Title;
     Order = manualType.Order;
 }
Пример #5
0
 private ManualTypeDelete(ManualType manualType)
 {
     ManualTypeId = manualType.ManualTypeId;
     Title = manualType.Title;
 }
Пример #6
0
 private ManualTypeIndex(ManualType manualType)
 {
     ManualTypeId = manualType.ManualTypeId;
     Title = manualType.Title;
     Order = manualType.Order;
 }
Пример #7
0
        public static ManualTypeEdit GetModelView(ManualType manualType)
        {
            if (manualType == null)
                return null;

            var manualTypeEdit = new ManualTypeEdit(manualType);
            return manualTypeEdit;
        }
Пример #8
0
        public static ManualTypeDelete GetModelView(ManualType manualType)
        {
            if (manualType == null)
                return null;

            var manualTypeDelete = new ManualTypeDelete(manualType);
            return manualTypeDelete;
        }
Пример #9
0
 private bool IsAccess(ManualType manualType)
 {
     return manualType != null;
 }
Пример #10
0
 private ManualsByTypeIndex(BaseController baseController, ManualType manualType, int pageNumber, int pageSize)
 {
     Title = String.Format("{0} - {1}", ViewResource.ManualsByType_Index_Title_Text, manualType.Title);
     Manuals = manualType.Manuals.OrderBy(m => m.Order).Select(m => new ManualDashboard.Manual(baseController, m)).ToPagedList(pageNumber, pageSize);
 }
Пример #11
0
 public ManualTypeItem(ManualType manualType, Manual[] manuals, bool isMore, bool isOddBlock)
 {
     ManualType = manualType;
     Manuals = manuals;
     IsMore = isMore;
     CssClass = isOddBlock ? ManualTypesOddBlockCssClass : ManualTypesEvenBlockCssClass;
 }
Пример #12
0
 private static ManualType GetManualType(Models.ManualType manualType)
 {
     var localManualType = new ManualType(manualType.ManualTypeId, manualType.Title);
     return localManualType;
 }
Пример #13
0
 public static void Insert(DefaultContext db, ManualType manualType)
 {
     db.ManualTypes.Add(manualType);
     db.SaveChanges();
 }