public ActionResult <Commerce> Update(string tokenId, CommerceDto commerce)
        {
            var clientRequest = _commerceService.Get(tokenId);

            if (clientRequest == null)
            {
                return(NotFound());
            }

            return(_commerceService.Update(tokenId, commerce).Result);
        }
示例#2
0
        public async Task <Commerce> Register(CommerceDto commerce)
        {
            var created = await ShopsCollection.AddAsync(new Commerce
            {
                BusinessName  = commerce.CommerceName,
                GeoPoint      = new GeoPoint(commerce.Latitude, commerce.Longitude),
                Address       = commerce.Address,
                Capacity      = commerce.Capacity,
                MailAddress   = commerce.MailAddress,
                PhoneNumber   = commerce.PhoneNumber,
                LogoTypeImage = commerce.LogoTypeImage
            });

            return(Get(created.Id));
        }
示例#3
0
        public async Task <Commerce> Update(string tokenId, CommerceDto commerce)
        {
            var docRef = ShopsCollection.Document(tokenId);
            await docRef.UpdateAsync(new Dictionary <string, object>
            {
                { "CommerceName", commerce.CommerceName },
                { "GeoPoint", new GeoPoint(commerce.Latitude, commerce.Longitude) },
                { "Address", commerce.Address },
                { "Capacity", commerce.Capacity },
                { "MailAddress", commerce.MailAddress },
                { "PhoneNumber", commerce.PhoneNumber },
                { "LogoTypeImage", commerce.LogoTypeImage }
            });

            var snapshot = docRef.GetSnapshotAsync().Result;

            return(snapshot.ConvertTo <Commerce>());
        }
        public ActionResult <Commerce> Create(CommerceDto commerceDto)
        {
            var commerce = _commerceService.Register(commerceDto).Result;

            return(new ActionResult <Commerce>(commerce));
        }