public static Dog FromDog(Models.User owner, Models.Dog dog) => new Dog() { Id = dog.Id, Birthday = dog.Birthday, Name = dog.Name, Breed = dog.Breed, Weight = dog.Weight, Sex = dog.Sex, Avatar = dog.Avatar, OwnerUsername = owner?.Username, OwnerPhone = owner?.Phone };
public ApiResult AddOneDog(Models.Dog dog) { Dog temp = new Dog(); temp.Position = dog.Position; temp.Fajta = dog.Fajta; temp.Szine = dog.Szine; temp.Serult = dog.Serult; temp.Nem = dog.Nem; temp.Kutyameret = dog.Kutyameret; temp.Viselkedes = dog.Viselkedes; Logic.AddDogToDatabase(temp); return(new ApiResult() { OperationResult = true }); }
public ActionResult Edit(Guid id, IFormCollection collection) { try { Models.Dog dog = dogs.FirstOrDefault(x => x.Id.Equals(id)); dog.Age = int.Parse(collection["Age"]); dog.Weight = int.Parse(collection["Weight"]); dog.Name = collection["Name"]; dog.Breed = collection["Breed"]; // TODO: Add update logic here return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult NewDogForm(bool GoodWithKids, bool Drooling, Enums.ELength Length, Enums.EScale ActivityLvl, Enums.EScale SheddingLvl, Enums.EScale GroomingLvl, Enums.EScale IntelligenceLvl, Enums.ESize Size) { MakeDogDatabase DogDB = new MakeDogDatabase(); List <Dog> DogList = DogDB.makeDatabase(); Dog newDog = new Models.Dog { GoodWithChildren = GoodWithKids, Drools = Drooling, Coatlength = Length, ActivityLevel = ActivityLvl, SheddingLevel = SheddingLvl, GroomingLevel = GroomingLvl, IntelligenceLevel = IntelligenceLvl, Size = Size }; foreach (Dog dog in DogList) { if (dog.CompareTo(newDog)) { return(View("NewDogConfirm", dog)); } } Dog firstDog = DogList[0]; return(View("NewDogConfirm", firstDog)); }
public ActionResult Create(IFormCollection collection) { try { Models.Dog dog = new Models.Dog(); dog.Id = Guid.NewGuid(); dog.Age = int.Parse(collection["Age"]); dog.Weight = int.Parse(collection["Weight"]); dog.Name = collection["Name"]; dog.Breed = collection["Breed"]; dogs.Add(dog); // TODO: Add insert logic here return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
// GET: /<controller>/ public IActionResult Index() { Models.Dog doggie = new Models.Dog(); return(View()); }