public JsonResult Index(Person person) { WeddingRepos weddingRepos = new WeddingRepos(); weddingRepos.AddOrGetPerson(person); //weddingContext return new JsonResult(); }
public void AddOrGetPerson(Person person) { try { WeddingContext weddingContext = new WeddingContext(); weddingContext.Person.Add(person); weddingContext.SaveChanges(); } catch (Exception e) { throw; } }
// --- Mislim da ne dodaje duplikate po istom id-u public void AddPerson() { // var redisUsers = redis.As<Person>(); // redisUsers.GetNextSequence() var toske = new Person { id = 1, name = "Toske pijanac" }; var milojko = new Person { id = 2, name = "Milojko bre" }; var tripuskic = new Person { id = 3, name = "Tripuskic bez komentara" }; // redisUsers.Store(toske); // redisUsers.Store(milojko); // Dodaje objekat tipa Person u bazu redis.As<Person>().Store(toske); redis.As<Person>().Store(milojko); redis.As<Person>().Store(tripuskic); }
public void RenamePerson() { // --- Izmena imena --- // izgleda da je ovako var milojko = new Person { id = 2, name = "Milojko Komarac" }; redis.As<Person>().Store(milojko); }