Ejemplo n.º 1
0
        public async Task <JsonResult> OnPost(string name, string creditlimit, string salesrep)
        {
            IDatabase db = _connection.GetDatabase();

            Dictionary <RedisValue, RedisValue> data = new Dictionary <RedisValue, RedisValue>();

            data.Add(Data.Entities.Customer.NAME, name);
            data.Add(Data.Entities.Customer.CREDITLIMIT, creditlimit);
            data.Add(Data.Entities.Customer.SALESREP, salesrep);

            Data.Repositories.Customer customerRep = new Data.Repositories.Customer(db);
            string id = await customerRep.Store(data);

            return(new JsonResult("ok"));
        }
Ejemplo n.º 2
0
        public async Task <JsonResult> OnPost(string id, string name, string creditlimit, string salesrep)
        {
            IDatabase db = _connection.GetDatabase();

            Data.Repositories.Customer customerRep = new Data.Repositories.Customer(db);
            var customer = await customerRep.GetById(id);

            customer[Data.Entities.Customer.NAME]        = name;
            customer[Data.Entities.Customer.CREDITLIMIT] = creditlimit;
            customer[Data.Entities.Customer.SALESREP]    = salesrep;

            await customerRep.Store(customer);

            return(new JsonResult("ok"));
        }