Пример #1
0
        public ActionResult Index()
        {
            int i;

            using (var db = new dotRDbEntities())
            {
                i = db.Resources.Count();
            }

            ViewBag.Message = string.Format("{0} resources in RDb", i);
            return(View());
        }
Пример #2
0
        public void AddResources(IEnumerable <Resource> resources)
        {
            bool containsDirtyInputs = resources.Any(
                resource => SanitizerService.InputsNeedSanitizing(new[]
            {
                resource.Name,
                resource.Description
            })
                );

            if (containsDirtyInputs)
            {
                return;
            }
            using (var db = new dotRDbEntities())
            {
                db.Resources.AddRange(resources);
                db.SaveChanges();
            }
        }