Example #1
0
        public async Task <MixingInfo> Mixing(MixingInfoForCreateDto mixing)
        {
            var item = _mapper.Map <MixingInfoForCreateDto, MixingInfo>(mixing);

            item.Code        = CodeUtility.RandomString(8);
            item.CreatedTime = DateTime.Now;
            var glue = _repoGlue.FindById(mixing.GlueID);

            item.ExpiredTime = DateTime.Now.AddMinutes(glue.ExpiredTime);
            _repoMixingInfor.Add(item);
            await _repoMixingInfor.SaveAll();

            return(item);
        }
Example #2
0
        public async Task <MixingInfo> Mixing(MixingInfoForCreateDto mixing)
        {
            try
            {
                var item = _mapper.Map <MixingInfoForCreateDto, MixingInfo>(mixing);
                item.Code        = CodeUtility.RandomString(8);
                item.CreatedTime = DateTime.Now;
                var glue = await _repoGlue.FindAll().FirstOrDefaultAsync(x => x.isShow == true && x.ID == mixing.GlueID);

                item.ExpiredTime = DateTime.Now.AddMinutes(glue.ExpiredTime);
                _repoMixingInfor.Add(item);
                await _repoMixingInfor.SaveAll();

                // await _repoMixing.AddOrUpdate(item.ID);
                return(item);
            }
            catch
            {
                return(new MixingInfo());
            }
        }