Exemplo n.º 1
0
        public async Task <bool> UpdateAnimalLiveAnimal(LiveAnimal model)
        {
            try
            {
                var id = model.Id;
                await _repository.UpdateAsync <LiveAnimal>(e => e.Id == id, model);

                return(true);
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"UpdateAnimalLiveAnimal Failed: {e.Message}");
                return(false);
            }
        }
Exemplo n.º 2
0
        private async Task <LiveAnimal> BuildAnimal(LiveAnimalViewModel model)
        {
            var category = await _repository.GetItemAsync <Category>(e => e.Id == model.Category);

            LiveAnimal liveAnimal = new LiveAnimal
            {
                Id            = model.Id,
                Title         = model.Title,
                TitleBn       = model.TitleBn,
                Category      = category,
                Color         = model.Color,
                Location      = model.Location,
                LocationBn    = model.LocationBn,
                Origin        = model.Origin,
                OriginBn      = model.OriginBn,
                Price         = model.Price,
                Description   = model.Description,
                DescriptionBn = model.DescriptionBn,
                Images        = model.Images,
                CoverImage    = model.CoverImage,
                Featured      = model.Featured,
                Weight        = model.Weight,
                Height        = model.Height,
                Teeth         = model.Teeth,
            };
            Dictionary <string, string> color = new Dictionary <string, string>
            {
                { "Black", "কালো" },
                { "White", "সাদা" },
                { "Red", "লাল" },
                { "Mixed", "মিশ্র" },
                { "Ash", "খাকি" }
            };

            liveAnimal.ColorBn = color[model.Color];
            return(liveAnimal);
        }
Exemplo n.º 3
0
        public async Task <bool> AddTransection(string TranxId, string Name, double Amount, StatusEnum Status, LiveAnimal liveAnimal, Order order)
        {
            Transaction transaction = new Transaction
            {
                TranxId = TranxId,
                Name    = Name,
                Amount  = Amount,
                Status  = Status,
            };
            var id = Guid.NewGuid().ToString();

            transaction.Id = id;
            if (liveAnimal != null)
            {
                transaction.Product = liveAnimal;
            }
            if (order != null)
            {
                transaction.Order = order;
            }
            transaction.transactionTime = DateTime.Now;
            await _repository.SaveAsync <Transaction>(transaction);

            return(true);
        }