• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# OData.Delta类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Web.OData.Delta的典型用法代码示例。如果您正苦于以下问题:C# Delta类的具体用法?C# Delta怎么用?C# Delta使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Delta类属于System.Web.OData命名空间,在下文中一共展示了Delta类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Put

        // PUT: odata/Notes(5)
        public async Task<IHttpActionResult> Put([FromODataUri] Guid key, Delta<Note> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Note note = await db.Notes.FindAsync(key);
            if (note == null)
            {
                return NotFound();
            }

            patch.Put(note);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!NoteExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(note);
        }
开发者ID:NicoJuicy,项目名称:blog-todomvc-angular-odata,代码行数:36,代码来源:NotesController.cs


示例2: Patch

 public async Task<IHttpActionResult> Patch([FromODataUri] int key, Delta<ETOPlaybook> product)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     var entity = await _context.ETOPlaybooks.FindAsync(key);
     if (entity == null)
     {
         return NotFound();
     }
     product.Patch(entity);
     try
     {
         await _context.SaveChangesAsync();
     }
     catch (DbUpdateConcurrencyException)
     {
         //if (!ProductExists(key))
         //{
         //    return NotFound();
         //}
         //else
         //{
         throw;
         //}
     }
     return Updated(entity);
 }
开发者ID:manuelbautista,项目名称:Milestone-MVC-Project,代码行数:29,代码来源:ETOPlaybookDTOController.cs


示例3: Patch

        public async Task<IHttpActionResult> Patch([FromODataUri] string customerId, Delta<Customer> customer)
        {
            if (!ModelState.IsValid)
                return BadRequest(ModelState);

            var entity = await _Repository.GetEntityAsync(new FindCustomerByIdSpecificationStrategy(customerId));
            if (entity == null)
                return NotFound();

            try
            {
                customer.Patch(entity);

                _Repository.Modify(entity);
                await _Repository.SaveAsync();

                return Updated(entity);
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerExists(customerId))
                    return NotFound();
                else
                    throw;
            }
        }
开发者ID:NRepository,项目名称:Northwind-Sample,代码行数:26,代码来源:CustomersController.cs


示例4: Patch

        public IHttpActionResult Patch([FromODataUri] int key, Delta<Order> patch)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Order order = db.Orders.Find(key);
            if (order == null)
            {
                return NotFound();
            }

            patch.Patch(order);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrderExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(order);
        }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:33,代码来源:OrdersV2Controller.cs


示例5: Patch

        public async Task<IHttpActionResult> Patch([FromODataUri] int key, Delta<Customer> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var customer = await _db.Customers.FindAsync(key);
            if (customer == null)
            {
                return NotFound();
            }

            patch.Patch(customer);

            try
            {
                await _db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CustomerExists(key))
                {
                    return NotFound();
                }
                throw;
            }

            return Updated(customer);
        }
开发者ID:chauey,项目名称:Swashbuckle.OData,代码行数:32,代码来源:CustomersController.cs


示例6: Put

        // PUT: odata/IMEI(5)
        public async Task<IHttpActionResult> Put([FromODataUri] int key, Delta<IMEIToCallsign> patch)
        {
            var imeiToCallsign = await _imeiService.GetFromId(key);
            if (imeiToCallsign == null)
            {
                return NotFound();
            }

            patch.Put(imeiToCallsign);

            Validate(imeiToCallsign);

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            await _imeiService.RegisterCallsign(imeiToCallsign.IMEI, imeiToCallsign.CallSign, imeiToCallsign.Type);

            var newIMEI = await _imeiService.GetFromIMEI(imeiToCallsign.IMEI);

            await _logService.LogIMEIRegistered(User.Identity.GetUserName(), newIMEI.IMEI, newIMEI.CallSign, newIMEI.Type);

            return Updated(newIMEI);
        }
开发者ID:trichards57,项目名称:new-bike-tracker,代码行数:26,代码来源:IMEIController.cs


示例7: Patch

        public async Task<IHttpActionResult> Patch([FromODataUri] int key, Delta<Product> product)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var entity = await db.Products.FindAsync(key);

            if (entity == null)
            {
                return NotFound();
            }

            product.Patch(entity);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                if (!ProductExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(entity);
        }
开发者ID:zidanfei,项目名称:OData,代码行数:34,代码来源:ProductsController.cs


示例8: Put

        // PUT: odata/Claims(5)
        public async Task<IHttpActionResult> Put([FromODataUri] Guid key, Delta<Claim> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            var claim = await db.Claims.FindAsync(key);
            if (claim == null)
            {
                return NotFound();
            }

            patch.Put(claim);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ClaimExists(key))
                {
                    return NotFound();
                }
                throw;
            }

            return Updated(claim);
        }
开发者ID:chivandikwa,项目名称:Angular-Starter,代码行数:33,代码来源:ClaimsController.cs


示例9: Patch

		public async Task<IHttpActionResult> Patch( [FromODataUri] int key, Delta<Account> patch )
		{
			Validate( patch.GetEntity() );

			if ( !ModelState.IsValid )
			{
				return BadRequest( ModelState );
			}

			var user = await _db.Accounts.SingleOrDefaultAsync( u => u.Id == key );
			if ( user == null )
			{
				return NotFound();
			}

			patch.Patch( user );

			try
			{
				await _db.SaveChangesAsync();
			}
			catch ( DbUpdateConcurrencyException )
			{
				if ( !ApplicationUserExists( key ) )
				{
					return NotFound();
				}
				else
				{
					throw;
				}
			}

			return Updated( user );
		}
开发者ID:MusicCityCode,项目名称:ConferenceServices,代码行数:35,代码来源:UsersController.cs


示例10: Patch

		public async Task<IHttpActionResult> Patch([FromODataUri] int key, Delta<Customer> Customer)
		{
			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}
			var entity = await db.Customers.FindAsync(key);
			if (entity == null)
			{
				return NotFound();
			}
			Customer.Patch(entity);
			try
			{
				await db.SaveChangesAsync();
			}
			catch (DbUpdateConcurrencyException)
			{
				if (!CustomerExists(key))
				{
					return NotFound();
				}
				else
				{
					throw;
				}
			}
			return Updated(entity);
		}
开发者ID:joshcomley,项目名称:WebApi,代码行数:29,代码来源:CustomersController.cs


示例11: Patch

        public IHttpActionResult Patch([FromODataUri] int key, Delta<Product> patch)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Product product = db.Products.Find(key);
            if (product == null)
            {
                return NotFound();
            }

            patch.Patch(product);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ProductExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(product);
        }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:33,代码来源:ProductsV2Controller.cs


示例12: Patch

        public IHttpActionResult Patch([FromODataUri] int key, Delta<Category> patch)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Category category = db.Categories.Find(key);
            if (category == null)
            {
                return NotFound();
            }

            patch.Patch(category);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CategoryExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(category);
        }
开发者ID:respag,项目名称:NorthwindAPI,代码行数:33,代码来源:CategoriesController.cs


示例13: Patch

        public IHttpActionResult Patch([FromODataUri] int key, Delta<OptionSetEntity> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            OptionSetEntity optionSetEntity = db.OptionSetEntities.Find(key);
            if (optionSetEntity == null)
            {
                return NotFound();
            }

            patch.Patch(optionSetEntity);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OptionSetEntityExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(optionSetEntity);
        }
开发者ID:DureSameen,项目名称:ContactsCRMOdata,代码行数:35,代码来源:OptionSetEntitiesController.cs


示例14: Put

        // PUT: odata/Students(5)
        public async Task<IHttpActionResult> Put([FromODataUri] int key, Delta<Student> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Student student = await db.Students.FindAsync(key);
            if (student == null)
            {
                return NotFound();
            }

            patch.Put(student);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!StudentExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(student);
        }
开发者ID:gyb333,项目名称:Gyb.Platform,代码行数:36,代码来源:StudentsController.cs


示例15: Put

        // PUT: odata/PlatformsImporter(5)
        public async Task<IHttpActionResult> Put([FromODataUri] string key, Delta<Platform> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Platform platform = await db.Platforms.FindAsync(key);
            if (platform == null)
            {
                return NotFound();
            }

            patch.Put(platform);

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PlatformExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(platform);
        }
开发者ID:pandazzurro,项目名称:uPlayAgain,代码行数:36,代码来源:PlatformsImporterController.cs


示例16: Patch

        public IHttpActionResult Patch(int key, Delta<Employee> employee)
        {
            Employee originalEmployee = Employees.Single(e => e.Id == key);
            employee.Patch(originalEmployee);

            return Ok(employee);
        }
开发者ID:ZhaoYngTest01,项目名称:WebApi,代码行数:7,代码来源:OpenTypeControllers.cs


示例17: Patch

        public IHttpActionResult Patch([FromODataUri] int key, Delta<Person> patch)
        {
            Validate(patch.GetEntity());

            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            Person person = db.People.Find(key);
            if (person == null)
            {
                return NotFound();
            }

            patch.Patch(person);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!PersonExists(key))
                {
                    return NotFound();
                }
                else
                {
                    throw;
                }
            }

            return Updated(person);
        }
开发者ID:Guanyi,项目名称:W07a,代码行数:35,代码来源:PersonController.cs


示例18: Patch

		public async Task<IHttpActionResult> Patch([FromODataUri] int key, Delta<TranslatedCompany> delta, [ValueProvider(typeof(CultureValueProviderFactory))] string culture = "en-US")
		{
			var company = new Company(delta.GetEntity(), culture);
			company.Map = UpdateMapImage(company.Map);
			var tochange = _companiesManager.Patch(key, company);

			try
			{
				await _companiesManager.SaveChanges();
			}
			catch (DbUpdateConcurrencyException)
			{
				if (!_companiesManager.Exists(tochange.Id))
				{
					return NotFound();
				}
				else
				{
					throw;
				}
			}

			return Updated(tochange);

		}
开发者ID:WorkMarketingNet,项目名称:WMN.Companies,代码行数:25,代码来源:CompaniesController.cs


示例19: Patch

 public IHttpActionResult Patch([FromODataUri] long key, Delta<Product> patch)
 {
     if (!ModelState.IsValid)
     {
         return BadRequest(ModelState);
     }
     return Updated(_repository.Patch(key, patch, Request));
 }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:8,代码来源:ProductsV2Controller.cs


示例20: PatchMe

        public IHttpActionResult PatchMe(Delta<Person> patch)
        {
            if (!ModelState.IsValid)
            {
                return BadRequest(ModelState);
            }

            patch.Patch(TripPinSvcDataSource.Instance.Me);
            return Updated(TripPinSvcDataSource.Instance.Me);
        }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:10,代码来源:SingletonController.cs



注:本文中的System.Web.OData.Delta类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Deserialization.ODataDeserializerContext类代码示例发布时间:2022-05-26
下一篇:
C# Test.MockBuildManager类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap