예제 #1
0
 public static void FillDto(Models.Journal entity, ViewModels.JournalX journal)
 {
     journal.Id      = entity.Id;
     journal.TypeId  = entity.TypeId;
     journal.Title   = entity.Title;
     journal.Remark  = entity.Remark;
     journal.Website = entity.Website;
 }
예제 #2
0
 public static void Fill(Models.Journal entity, ViewModels.JournalX journal)
 {
     entity.Id      = journal.Id;
     entity.TypeId  = journal.TypeId;
     entity.Title   = journal.Title;
     entity.Remark  = journal.Remark;
     entity.Website = journal.Website;
 }
예제 #3
0
        public virtual CustomActionResult CanDelete(Models.Journal entity)
        {
            var books = this.context.Books.Count(q => q.JournalId == entity.Id);

            if (books > 0)
            {
                return(Exceptions.getCanNotDeleteException("Journal-03"));
            }

            return(new CustomActionResult(HttpStatusCode.OK, ""));
        }
        public async Task <IActionResult> OnGetAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Journal = await _context.Journal.FirstOrDefaultAsync(m => m.ID == id);

            if (Journal == null)
            {
                return(NotFound());
            }
            return(Page());
        }
예제 #5
0
        public async Task <IActionResult> OnPostAsync(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            Journal = await _context.Journal.FindAsync(id);

            if (Journal != null)
            {
                _context.Journal.Remove(Journal);
                await _context.SaveChangesAsync();
            }

            return(RedirectToPage("./Index"));
        }