public IHttpActionResult PutBaseWord(int id, BaseWord baseWord) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != baseWord.Id) { return(BadRequest()); } db.Entry(baseWord).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!BaseWordExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult DeleteConfirmed(int id) { BaseWord baseWord = db.BaseWords.Find(id); db.BaseWords.Remove(baseWord); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Word")] BaseWord baseWord) { if (ModelState.IsValid) { db.Entry(baseWord).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(baseWord)); }
public ActionResult Create([Bind(Include = "Id,Word")] BaseWord baseWord) { if (ModelState.IsValid) { db.BaseWords.Add(baseWord); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(baseWord)); }
public IHttpActionResult GetBaseWord(int id) { BaseWord baseWord = db.BaseWords.Find(id); if (baseWord == null) { return(NotFound()); } return(Ok(baseWord)); }
public IHttpActionResult PostBaseWord(BaseWord baseWord) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.BaseWords.Add(baseWord); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = baseWord.Id }, baseWord)); }
public ExportToWord(string docTemplate) { _docTemplate = docTemplate; FileInfo fileInfo = new FileInfo(_docTemplate); string ext = fileInfo.Extension.ToUpper(); if (string.IsNullOrWhiteSpace(_docTemplate) || !fileInfo.Exists || (!ext.Equals(".DOC") && !ext.Equals(".DOCX"))) { throw new ArgumentException("File word template không đúng."); } _baseWord = new BaseWord(); }
// GET: BaseWords/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } BaseWord baseWord = db.BaseWords.Find(id); if (baseWord == null) { return(HttpNotFound()); } return(View(baseWord)); }
public IHttpActionResult DeleteBaseWord(int id) { BaseWord baseWord = db.BaseWords.Find(id); if (baseWord == null) { return(NotFound()); } db.BaseWords.Remove(baseWord); db.SaveChanges(); return(Ok(baseWord)); }
/// <summary> /// Serves as a hash function for a particular type. /// </summary> /// <returns> /// A hash code for the current <see cref="T:System.Object"/>. /// </returns> public override int GetHashCode() { return(Suffix.GetHashCode() + BaseWord.GetHashCode()); }