Exemple #1
0
        public async Task <bool> Create(AspNetRoleDto aspNetRoleDto)
        {
            try
            {
                aspNetRoleDto.Id = Guid.NewGuid().ToString();
                DataAccess.Models.AspNetRole roles = Mapper.Map <DataAccess.Models.AspNetRole>(aspNetRoleDto);

                //db.Entry(aspNetRoleDto).State = EntityState.Added;
                db.AspNetRoles.Add(roles);
                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
        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);
            }
        }
Exemple #3
0
        public async Task <bool> Create(DirectionDto directionDto)
        {
            try
            {
                DataAccess.Models.Direction value = Mapper.Map <DataAccess.Models.Direction>(directionDto);

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

                db.Directions.Add(value);

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #4
0
        public async Task <bool> Create(CategoryDto categoryDto)
        {
            try
            {
                DataAccess.Models.Category value = Mapper.Map <DataAccess.Models.Category>(categoryDto);

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

                db.Categories.Add(value);

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #5
0
        public async Task <bool> Create(ProblemDto problemDto)
        {
            try
            {
                DataAccess.Models.Problem value = Mapper.Map <DataAccess.Models.Problem>(problemDto);

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

                db.Problems.Add(value);

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #6
0
        public async Task <bool> Create(StatusDto statusDto)
        {
            try
            {
                DataAccess.Models.Status value = Mapper.Map <DataAccess.Models.Status>(statusDto);

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

                db.Statuses.Add(value);

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #7
0
        public async Task <bool> Create(UnitDto obj)
        {
            try
            {
                Department value = Mapper.Map <Department>(obj);

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

                db.Departments.Add(value);

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #8
0
        public async Task <bool> Create(OfferDto obj)
        {
            try
            {
                DataAccess.Models.Offer value = Mapper.Map <DataAccess.Models.Offer>(obj);

                value.DatePublication = DateTime.Now;

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

                db.Offers.Add(value);

                await db.SaveChangesAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Exemple #9
0
        public async Task <bool> Delete(AspNetUserDto aspNetUserDto)
        {
            try
            {
                DataAccess.Models.AspNetUser value = Mapper.Map <DataAccess.Models.AspNetUser>(aspNetUserDto);

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

                await db.SaveChangesAsync();

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