Exemple #1
0
        public ActionResult CreateRanks(PERSON_RANKS rank, FormCollection collection)
        {
            try
            {

                var f = collection.GetValue("head");
                string head = f.AttemptedValue.ToString();
                var au = collection.GetValue("rank");
                string audi = au.AttemptedValue.ToString();

                if ((from c in ctx.PERSON_RANKS where c.PERSON.PR_NAME == head && c.DIC_RANKS.DRK_NAME == audi select c).Any())
                {
                    return RedirectToAction("AllRelations");
                }
                else
                {
                    var person = (from c in ctx.PERSON where c.PR_NAME == head select c).First();
                    var audience = (from c in ctx.DIC_RANKS where c.DRK_NAME == audi select c).First();

                    PERSON_RANKS rel = new PERSON_RANKS();

                    rel.PERSON = person;
                    rel.DIC_RANKS = audience;

                    ctx.PERSON_RANKS.Add(rel);
                    ctx.SaveChanges();

                }

                return RedirectToAction("AllRelations");

            }
            catch
            {
                return RedirectToAction("Problem");
            }
            return View();
        }
Exemple #2
0
 public ActionResult Create()
 {
     PERSON_RANKS rank = new PERSON_RANKS();
     return View(rank);
 }