public async Task <IActionResult> PutMessageFromPastSelf(long id, MessageFromPastSelf messageFromPastSelf) { if (id != messageFromPastSelf.Id || !EmailValidator.Validate(messageFromPastSelf.To) || messageFromPastSelf.Body.Length < 1) { return(BadRequest()); } var jobid = _mailService.updateEmail(messageFromPastSelf); messageFromPastSelf.jobid = jobid; _context.Entry(messageFromPastSelf).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!MessageFromPastSelfExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public ActionResult Edit([Bind(Include = "ID,fromemail,toemail,subjectemail,messageemail,curuser")] Mail mail) { if (ModelState.IsValid) { db.Entry(mail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(mail)); }