Пример #1
0
 public IActionResult addRes(ResourceModel obj)
 {
     try
     {
         _commRes.addResource(obj);
         _commRes.saveResourec();
         return(Ok());
     }
     catch
     {
         return(BadRequest());
     }
 }
Пример #2
0
        public IActionResult addResources()
        {
            var counter   = 0;
            var resources = new List <ResourceModel>
            {
                new ResourceModel
                {
                    user_code           = "res001",
                    enabled_flg         = 1,
                    url                 = "www.google.ca",
                    title               = "Some resources",
                    desc                = "Descrpition for the resource",
                    resource_CategoryId = 1
                },
                new ResourceModel
                {
                    user_code           = "res002",
                    enabled_flg         = 0,
                    url                 = "www.google.ca",
                    title               = "Some title for res2",
                    desc                = "Description for the res2",
                    resource_CategoryId = 2
                },
                new ResourceModel
                {
                    user_code           = "res003",
                    enabled_flg         = 0,
                    url                 = "www.google.ca",
                    title               = "Some title for res3",
                    desc                = "Description for the res3",
                    resource_CategoryId = 3
                }
            };

            foreach (var item in resources)
            {
                _commconService.addResource(item);
                counter++;
            }
            var tmp = _commconService.saveResourec();

            return(Ok(tmp));
        }