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; } } }
public ActionResult Delete(CallForPapers callforpaper) { try { DeleteCallForPapersViewModel model = new DeleteCallForPapersViewModel(ModelState.IsValid, callforpaper, CallForPaperService); return(View(model)); } catch (System.Exception) { return(RedirectToRoute("~/Shared/Error")); } }
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")); } }
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"; } }
public static CallForPapersDto AsDto(this CallForPapers dbModel) => new()
public async Task UpdateAsync(CallForPapers callForPapers) { _callForPapers.Update(callForPapers); await _context.SaveChangesAsync(); }
public async Task AddAsync(CallForPapers callForPapers) { await _callForPapers.AddAsync(callForPapers); await _context.SaveChangesAsync(); }