Пример #1
0
        public async Task <bool> Update(TypeOfOfferDto typeOfOfferDto)
        {
            DataAccess.Models.TypeOfOffer value = Mapper.Map <DataAccess.Models.TypeOfOffer>(typeOfOfferDto);

            try
            {
                db.Entry(value).State = EntityState.Modified;

                await db.SaveChangesAsync();

                return(true);
            }
            catch { return(false); }
        }
Пример #2
0
        public async Task <bool> Create(TypeOfOfferDto typeOfOfferDto)
        {
            try
            {
                DataAccess.Models.TypeOfOffer value = Mapper.Map <DataAccess.Models.TypeOfOffer>(typeOfOfferDto);

                db.Entry(value).State = EntityState.Added;

                db.TypeOfOffers.Add(value);

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Пример #3
0
        public async Task <bool> Delete(TypeOfOfferDto typeOfOfferDto)
        {
            try
            {
                DataAccess.Models.TypeOfOffer value = Mapper.Map <DataAccess.Models.TypeOfOffer>(typeOfOfferDto);

                value.DeletedDateTime = DateTime.Now;
                value.IsDeleted       = true;

                db.Entry(value).State = EntityState.Modified;

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }