コード例 #1
0
        public void Upload(IEntityService <Paper> service)
        {
            Status = true;
            using (var database = new DatabaseContext())
            {
                CallForPapers = database.CallsForPapers.FirstOrDefault(t => t.Id == CallForPapersId);
            }
            string path = saveFile();

            if (path != null)
            {
                Paper paper = new Paper(CallForPapers, path);
                try
                {
                    service.Add(paper);
                    Status = true;
                }
                catch (Exception)
                {
                    Status  = false;
                    Message = "An error occured while adding the paper";
                    throw;
                }
            }
        }
コード例 #2
0
 public ActionResult Delete(CallForPapers callforpaper)
 {
     try
     {
         DeleteCallForPapersViewModel model = new DeleteCallForPapersViewModel(ModelState.IsValid, callforpaper, CallForPaperService);
         return(View(model));
     }
     catch (System.Exception)
     {
         return(RedirectToRoute("~/Shared/Error"));
     }
 }
コード例 #3
0
 public ActionResult Create([Bind(Include = "Id,Acronym,Name,StartDate,DeadlineAbstract,DeadlineProposal")] CallForPapers callForPapers)
 {
     try
     {
         CreateCallForPapersViewModel model = new CreateCallForPapersViewModel(ModelState.IsValid, callForPapers, CallForPaperService);
         return(View(model));
     }
     catch (System.Exception)
     {
         return(RedirectToRoute("~/Shared/Error"));
     }
 }
コード例 #4
0
        public SubmitPaperViewModel(int id)
        {
            Message = null;
            Status  = true;
            Title   = "Submit paper";

            CallForPapersId = id;

            using (var database = new DatabaseContext())
            {
                CallForPapers = database.CallsForPapers.FirstOrDefault(t => t.Id == CallForPapersId);
            }



            if (DateTime.Compare(CallForPapers.DeadlineProposal, DateTime.Now) == -1)
            {
                Status  = false;
                Message = "We are sorry to inform you, but the deadline for the conference " + CallForPapers.Name + " has passed(" + CallForPapers.DeadlineProposal + "). You can no longer submit papers";
            }
        }
コード例 #5
0
 public static CallForPapersDto AsDto(this CallForPapers dbModel)
 => new()
コード例 #6
0
 public async Task UpdateAsync(CallForPapers callForPapers)
 {
     _callForPapers.Update(callForPapers);
     await _context.SaveChangesAsync();
 }
コード例 #7
0
        public async Task AddAsync(CallForPapers callForPapers)
        {
            await _callForPapers.AddAsync(callForPapers);

            await _context.SaveChangesAsync();
        }