/// <summary>
 /// Product Types
 /// </summary>
 /// The Products endpoint returns information about the Uber products offered
 /// at a given location. The response includes the display name and other
 /// details about each product, and lists the products in the proper display
 /// order.
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='animalCreateOrUpdateParameter'>
 /// An Animal
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task<Animal> CreateOrUpdatePolymorphicAnimalsAsync( this IPolymorphicAnimalStore operations, Animal animalCreateOrUpdateParameter = default(Animal), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateOrUpdatePolymorphicAnimalsWithHttpMessagesAsync(animalCreateOrUpdateParameter, null, cancellationToken).ConfigureAwait(false))
     {
         return _result.Body;
     }
 }
Пример #2
0
        public Animal AddNew(Animal animal)
        {
            this.animals.Add(animal);

            this.animals.SaveChanges();

            return animal;
        }
 public ActionResult Create(FormCollection collection)
 {
     var animal = new Animal();
     //if (TryUpdateModel(animal, collection))
     //    throw new ArgumentException("Bad input");
     animal.Name = collection["Name"];
     var topSpeed = collection["TopSpeed"];
     animal.TopSpeed = Convert.ToInt32(topSpeed);
     animal.Status = collection["Status"];
     //var s = collection["Habitat"];
     //animal.Habitat = s.ToList();
     //animal.Habitat = collection["Habitat"];
     animal.ImageAddress = collection["ImageAddress"];
     RavenSession.Store(animal, animal.Name);
     return RedirectToAction("Index");
 }
 /// <summary>
 /// Product Types
 /// </summary>
 /// The Products endpoint returns information about the Uber products offered
 /// at a given location. The response includes the display name and other
 /// details about each product, and lists the products in the proper display
 /// order.
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='animalCreateOrUpdateParameter'>
 /// An Animal
 /// </param>
 public static Animal CreateOrUpdatePolymorphicAnimals(this IPolymorphicAnimalStore operations, Animal animalCreateOrUpdateParameter = default(Animal))
 {
     return Task.Factory.StartNew(s => ((IPolymorphicAnimalStore)s).CreateOrUpdatePolymorphicAnimalsAsync(animalCreateOrUpdateParameter), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult();
 }
Пример #5
0
        public IQueryable<Animal> UpdateAnimal(Animal updatedAnimal)
        {
            this.animals.Update(updatedAnimal);
            this.animals.SaveChanges();

            return this.animals
                .All()
                .Where(r => r.Id == updatedAnimal.Id);
        }