当前位置: 首页>>代码示例>>C#>>正文


C# Delta.GetEntity方法代码示例

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


在下文中一共展示了Delta.GetEntity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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

示例3: 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

示例4: 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

示例5: Put

		// PUT: odata/Users(5)
		public async Task<IHttpActionResult> Put( [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.Put( user );

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

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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: Put

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

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

            // TODO: Get the entity here.

            // delta.Put(employee);

            // TODO: Save the patched entity.

            // return Updated(employee);
            return StatusCode(HttpStatusCode.NotImplemented);
        }
开发者ID:debapamdas,项目名称:GenericEntityFramework,代码行数:19,代码来源:EmployeesController.cs

示例11: Patch

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

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

            // TODO: Get the entity here.

            // delta.Patch(product);

            // TODO: Save the patched entity.

            // return Updated(product);
            return StatusCode(HttpStatusCode.NotImplemented);
        }
开发者ID:nickgoodrow,项目名称:ODataSamples,代码行数:18,代码来源:ProductsController.cs

示例12: Put

        // PUT: odata/Players(5)
        public IHttpActionResult Put([FromODataUri] int key, Delta<Player> delta)
        {
            Validate(delta.GetEntity());

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

            // TODO: Get the entity here.
            var player = (from p in _cricketContext.Players
                          where p.Id == key
                          select p).First();

            delta.Put(player);

            // TODO: Save the patched entity.

            // return Updated(player);
            return StatusCode(HttpStatusCode.NotImplemented);
        }
开发者ID:kevinrjones,项目名称:edft,代码行数:22,代码来源:PlayersController.cs

示例13: Put

        // PUT: odata/Orders(5)
        public async Task<IHttpActionResult> Put([FromODataUri] long key, Delta<CGC.DH.Order.API.Models.Order> patch)
        {
            Validate(patch.GetEntity());

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

            CGC.DH.Order.API.Models.Order order = await db.Orders.FindAsync(key);
            if (order == null)
            {
                return NotFound();
            }

            //patch.Put(order);
            patch.Patch(order);

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

            return Updated(order);
        }
开发者ID:MCornel,项目名称:OWIN_ODATA_ORDERS_API,代码行数:37,代码来源:OrdersController.cs

示例14: Patch

        public async Task<IHttpActionResult> Patch([FromODataUri] System.Guid key, Delta<Tournament> delta)
        {
            Validate(delta.GetEntity());

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

            // TODO: Get the entity here.

            // delta.Patch(tournament);

            // TODO: Save the patched entity.

            // return Updated(tournament);
            return StatusCode(HttpStatusCode.NotImplemented);
        }
开发者ID:Rokory,项目名称:DebReg,代码行数:18,代码来源:TournamentsController.cs

示例15: Patch

		public async Task<IHttpActionResult> Patch([FromODataUri] string key, Delta<Namespace> ns, [ValueProvider(typeof(CultureValueProviderFactory))] string culture = "en-US")
		{
			if (!ModelState.IsValid)
			{
				return BadRequest(ModelState);
			}
			var entity = await db.Dictionaries.FindAsync(key);
			if (entity == null)
			{
				return NotFound();
			}

			foreach (var property in ns.GetChangedPropertyNames())
			{
				if (property == nameof(entity.Description))
				{
					entity.Description = ns.GetEntity().Description;
				}
			}
			try
			{
				await db.SaveChangesAsync();
			}
			catch (DbUpdateConcurrencyException)
			{
				if (!NamespaceExists(key))
				{
					return NotFound();
				}
				else
				{
					throw;
				}
			}
			return Updated(entity);
		}
开发者ID:WorkMarketingNet,项目名称:WMN.Translate,代码行数:36,代码来源:NamespacesController.cs


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