Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        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!"
            });
        }
Ejemplo n.º 3
0
        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"
            });
        }
Ejemplo n.º 4
0
        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"
            });
        }