public ActionResult DeleteConfirmed(Guid id) { TextItemType textItemType = db.TextItemTypes.Find(id); textItemType.IsDeleted = true; textItemType.DeletionDate = DateTime.Now; db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Title,Name,IsActive,CreationDate,LastModifiedDate,IsDeleted,DeletionDate,Description")] TextItemType textItemType) { if (ModelState.IsValid) { textItemType.IsDeleted = false; textItemType.LastModifiedDate = DateTime.Now; db.Entry(textItemType).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(textItemType)); }
/// <summary> /// Add a text with a certain text type /// </summary> /// <param name="message">text to append</param> /// <param name="textItemType">Type of text</param> /// <param name="className">Class name for formatting</param> /// <param name="data">An object array to format</param> public void AddText(string message, TextItemType textItemType, string className = null, params object[] data) { if (!KeepEmptyItems && string.IsNullOrEmpty(message)) { return; } TextItems.Add(new TextItem { LogicalType = textItemType, Content = string.Format(message, data), ClassName = className }); }
/// <summary> /// Add a text with a certain text type /// </summary> /// <param name="message">text to append</param> /// <param name="textItemType">Type of text</param> /// <param name="className">Class name for formatting</param> public void AddText(string message, TextItemType textItemType, string className = null) { if (!KeepEmptyItems && string.IsNullOrEmpty(message)) { return; } TextItems.Add(new TextItem { LogicalType = textItemType, Content = message, ClassName = className }); }
// GET: TextItemTypes/Delete/5 public ActionResult Delete(Guid?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TextItemType textItemType = db.TextItemTypes.Find(id); if (textItemType == null) { return(HttpNotFound()); } return(View(textItemType)); }
public ActionResult Create([Bind(Include = "Id,Title,Name,IsActive,CreationDate,LastModifiedDate,IsDeleted,DeletionDate,Description")] TextItemType textItemType) { if (ModelState.IsValid) { textItemType.IsDeleted = false; textItemType.CreationDate = DateTime.Now; textItemType.Id = Guid.NewGuid(); db.TextItemTypes.Add(textItemType); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(textItemType)); }
public async Task Add(TextItemType textItemType) { await this.ExecuteInContextAsync(async dbContext => { var entity = new Entities.TextItemType() { GUID = textItemType.Identity.Value, Name = textItemType.Name, }; dbContext.Add(entity); await dbContext.SaveChangesAsync(); }); }
public async Task <TextItemType> Get(TextItemTypeIdentity identity) { var textItemType = await this.ExecuteInContextAsync(async dbContext => { var entity = await dbContext.TextItemTypes.Where(x => x.GUID == identity.Value).SingleAsync(); var output = new TextItemType() { Identity = TextItemTypeIdentity.From(entity.GUID), Name = entity.Name, }; return(output); }); return(textItemType); }
public async Task <TextItemType> Get(string name) { var textItemType = await this.ExecuteInContextAsync(async dbContext => { var entity = await dbContext.TextItemTypes.Where(x => x.Name == name).SingleAsync(); var output = new TextItemType() { Identity = TextItemTypeIdentity.From(entity.GUID), Name = entity.Name, // Use entity name, not the input name for exactness. }; return(output); }); return(textItemType); }
public static async Task <TextItemType> Acquire(this ITextItemTypeRepository repository, string name) { var exists = await repository.Exists(name); var identity = exists ? await repository.GetIdentity(name) : await repository.New(name); var output = new TextItemType() { Identity = identity, Name = name, }; return(output); }
public InternalMatch(TextItemType textItemType, Match regexMatch) { TextItemType = textItemType; RegexMatch = regexMatch; }
public TextItem(string text, TextItemType itemType, Uri link = null) { Text = text; ItemType = itemType; Link = link; }
private static IEnumerable <InternalMatch> GetMatches(string text, string pattern, TextItemType textItemType) { return(Regex.Matches(text, pattern, RegexOptions.ExplicitCapture).Cast <Match>().Select(m => new InternalMatch(textItemType, m))); }