public ActionResult Index(string url) { var model = new FormatVM { Url = url }; if (!string.IsNullOrWhiteSpace(url)) { model.FormatLink = Url.Action("index", "format", new { url = url }, "http"); model.DisplayUrl = Url.Action("display", "format", new { url = url }, "http"); } return(View(model)); }
public async Task <ActionResult <ApiResult <string> > > PostNewFormat(FormatVM p) { Format f = new Format { FormatID = p.FormatID, Name = p.Name, }; _context.Formats.Add(f); _context.SaveChanges(); return(new ApiResult <string> { IsValid = true, Result = "Format '" + f.Name + "' was successfully uploaded!" }); }
public async Task <ActionResult <ApiResult <string> > > PutType(long tournamenttypeid, FormatVM p) { var t = _context.Formats.Where(x => x.FormatID.Equals(tournamenttypeid)).FirstOrDefault(); if (t != null) { t.Name = p.Name; _context.SaveChanges(); return(new ApiResult <string> { IsValid = true, Result = "Tournament Type '" + t.Name + "' was successfully updated!" }); } return(new ApiResult <string> { IsValid = false, Result = "Tournament Type not found" }); }
public async Task <ActionResult <ApiResult <string> > > PutFormat(long formatid, FormatVM p) { var f = _context.Formats.Where(x => x.FormatID.Equals(formatid)).FirstOrDefault(); if (f != null) { f.Name = p.Name; _context.SaveChanges(); return(new ApiResult <string> { IsValid = true, Result = "Format '" + f.Name + "' was successfully updated!" }); } return(new ApiResult <string> { IsValid = false, Result = "Format not found" }); }