Exemplo n.º 1
0
        public async Task <bool> UpdateWebinar(Webinars webinar)
        {
            try
            {
                var modelToBeUpdated = _context.Webinars.FirstOrDefaultAsync(webinarDetail => webinarDetail.Id == webinar.Id).Result;
                modelToBeUpdated.WebinarName        = webinar.WebinarName;
                modelToBeUpdated.CategoryId         = webinar.CategoryId;
                modelToBeUpdated.IsFeatured         = webinar.IsFeatured;
                modelToBeUpdated.WebinarTypeId      = webinar.WebinarTypeId;
                modelToBeUpdated.Duration           = webinar.Duration;
                modelToBeUpdated.Overview           = webinar.Overview;
                modelToBeUpdated.LearningObjectives = webinar.LearningObjectives;
                modelToBeUpdated.ReasonToAttend     = webinar.ReasonToAttend;
                modelToBeUpdated.AreasCovered       = webinar.AreasCovered;
                modelToBeUpdated.WhoWillBenefit     = webinar.WhoWillBenefit;
                modelToBeUpdated.FacultyId          = webinar.FacultyId;
                modelToBeUpdated.DateAndTime        = webinar.DateAndTime;
                modelToBeUpdated.ThumbImageUrl      = webinar.ThumbImageUrl;
                modelToBeUpdated.FacultyLocalId     = _context.Faculties.FirstOrDefaultAsync(faculty => faculty.Id == webinar.FacultyId).Result.LocalId;

                _context.Entry(modelToBeUpdated).State = EntityState.Modified;
                var response = await _context.SaveChangesAsync();

                return(response >= 1);
            }
            catch (DbUpdateException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public async Task <bool> UpdateLoginUserStatus(String userId, bool isLogin)
        {
            var modelToBeUpdated = GetUserLoginDetails(userId).Result;

            modelToBeUpdated.IsLogIn = isLogin;
            _context.Entry(modelToBeUpdated).State = EntityState.Modified;
            try
            {
                var response = await _context.SaveChangesAsync();

                return(response >= 1);
            }
            catch (DbUpdateException ex)
            {
                throw new DbUpdateException(ex.Message);
            }
        }
Exemplo n.º 3
0
        public async Task <bool> UpdateExistingCart(CartItems cartItem)
        {
            var modelToBeUpdated = GetUserCartItem(cartItem.CartId, cartItem.WebinarId).Result;

            modelToBeUpdated.Quantity = cartItem.Quantity;
            _context.Entry(modelToBeUpdated).State = EntityState.Modified;
            try
            {
                var response = await _context.SaveChangesAsync();

                return(response >= 1);
            }
            catch (DbUpdateException ex)
            {
                throw new DbUpdateException(ex.Message);
            }
        }
Exemplo n.º 4
0
        public async Task <bool> UpdateWebinarPurchasedOptionsDetails(WebinarPurchasedOptionsDetails webinarPurchasedOptionsDetails)
        {
            try
            {
                var modelToBeUpdated = _context.WebinarPurchasedOptionsDetails.FirstOrDefaultAsync(webinarPrice => webinarPrice.Id == webinarPurchasedOptionsDetails.Id).Result;
                modelToBeUpdated.MaxCount              = webinarPurchasedOptionsDetails.MaxCount;
                modelToBeUpdated.MaxDuration           = webinarPurchasedOptionsDetails.MaxDuration;
                modelToBeUpdated.Price                 = webinarPurchasedOptionsDetails.Price;
                _context.Entry(modelToBeUpdated).State = EntityState.Modified;
                var response = await _context.SaveChangesAsync();

                return(response >= 1);
            }
            catch (DbUpdateException ex)
            {
                throw new DbUpdateException(ex.Message);
            }
        }
Exemplo n.º 5
0
        public async Task <bool> UpdateFaculty(Faculties faculty)
        {
            try
            {
                var modelToBeUpdated = _context.Faculties.FirstOrDefaultAsync(webinarDetail => webinarDetail.Id == faculty.Id).Result;
                modelToBeUpdated.FirstName   = faculty.FirstName;
                modelToBeUpdated.LastName    = faculty.LastName;
                modelToBeUpdated.EmailId     = faculty.EmailId;
                modelToBeUpdated.MobileNo    = faculty.MobileNo;
                modelToBeUpdated.Bio         = faculty.Bio;
                modelToBeUpdated.CountryId   = faculty.CountryId;
                modelToBeUpdated.Designation = faculty.Designation;

                _context.Entry(modelToBeUpdated).State = EntityState.Modified;
                var response = await _context.SaveChangesAsync();

                return(response >= 1);
            }
            catch (DbUpdateException ex)
            {
                throw ex;
            }
        }
Exemplo n.º 6
0
        public async Task <bool> UpdateUser(UserTable userTable)
        {
            var modelToBeUpdated = GetUser(userTable.Id).Result;

            modelToBeUpdated.LocalId               = modelToBeUpdated.LocalId;
            modelToBeUpdated.FirstName             = userTable.FirstName;
            modelToBeUpdated.LastName              = userTable.LastName;
            modelToBeUpdated.EmailId               = userTable.EmailId;
            modelToBeUpdated.MobileNo              = userTable.MobileNo;
            modelToBeUpdated.CompanyId             = userTable.CompanyId;
            modelToBeUpdated.Designation           = userTable.EmailId;
            modelToBeUpdated.CountryId             = userTable.CountryId;
            _context.Entry(modelToBeUpdated).State = EntityState.Modified;
            try
            {
                var response = await _context.SaveChangesAsync();

                return(response >= 1);
            }
            catch (DbUpdateException ex)
            {
                throw new DbUpdateException(ex.Message);
            }
        }