Ejemplo n.º 1
0
        public async Task <UpdateMany> GetUpdateManyModel(UpdateMany m)
        {
            m.AddrLow    = Addr.Low;
            m.AddrHigh   = Addr.High;
            m.OldAddress = (ushort)m.Address;
            m.Colors     = await _colorRep.GetAllAsync();

            return(m);
        }
Ejemplo n.º 2
0
        public async Task UpdateManyAsync(UpdateMany m)
        {
            m.DefaultNumber = GetDefaultNumber(m.Address);
            bool isAddressPartChanged = IsAddressPartChanged(m.Address, m.OldAddress);

            foreach (string id in m.Id.Where(x => x != null))
            {
                await _rep.UpdateManyAsync(id, m.Address, m.DefaultNumber, m.ColorId, isAddressPartChanged);

                m.DefaultNumber++;
            }
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> UpdateMany(UpdateMany m)
        {
            try
            {
                await _service.UpdateManyAsync(m);

                return(RedirectToAction("Many"));
            }
            catch
            {
                return(View("CU_Failed"));
            }
        }
Ejemplo n.º 4
0
        public static DataContracts.UpdateResult UpdateMany <T>(string collectionName, FilterDefinition <T> filter, UpdateDefinition <T> update, UpdateOptions updateOptions, string schemaId = "", Notification notification = null)
        {
            var request = new UpdateMany
            {
                CollectionName = collectionName,
                OutputMode     = JsonOutputMode.Strict,
                Filter         = filter.ToJson(),
                Notification   = notification,
                Update         = update.ToBsonDocument().ToJson(),
                UpdateOptions  = updateOptions,
                SchemaId       = schemaId,
                CultureCode    = CultureInfo.CurrentCulture.Name
            };

            var response = Send <UpdateOneResponse>("entities/" + collectionName + "/bulk", request, "PUT");

            return(response.Result);
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> ShowUpdateMany(UpdateMany m)
        {
            m = await _service.GetUpdateManyModel(m);

            return(View("ShowUpdateMany", m));
        }