private void Seed(Orchard1Context _orchard1Context) { _orchard1Context.Database.EnsureDeleted(); _orchard1Context.AddRange(GetUsers()); _orchard1Context.AddRange(GetContactRequest()); _orchard1Context.AddRange(GetProductListingData()); _orchard1Context.SaveChanges(); }
private void Seed(Orchard1Context orchard1Context) { List <Users> check = orchard1Context.Users.ToList(); if (check.Count == 0) { orchard1Context.AddRange(new UserTestData().GetUsers().ToArray()); orchard1Context.SaveChanges(); } }
public async Task <bool> DisableUser(Users user) { try { FarmerDetails farmer = await _ApnaAaharContext.FarmerDetails.FirstOrDefaultAsync(users => users.UserId == user.UserId); farmer.IsAccountDisabled = true; farmer.IsApproved = false; if (_ApnaAaharContext.SaveChanges() > 0) { return(true); } return(false); } catch (DbUpdateException ex) { throw new DbContextException("DataBase Exception occured", ex); } }
/// <summary> /// /// </summary> /// <param name="contactRequestId"></param> /// <returns></returns> public bool DeleteContactRequests(int contactRequestId) { try { _Orchard1Context.ContactRequest.Remove(_Orchard1Context.ContactRequest.Find(contactRequestId)); } catch (Exception e) { throw new AnySqlException("Something Went Wrong", e); } int deleted = _Orchard1Context.SaveChanges(); return((deleted > 0) ? true : false); }
public void SeedUsers() { //Arrange _orchard1Context.Users.AddRange(GetUsersList().ToArray()); _orchard1Context.SaveChanges(); }
/* * MOCK DATA */ public void SeedProductListing() { Orchard1Context.ProductListingData.AddRange(GetListings().ToArray()); Orchard1Context.SaveChanges(); }
public async Task AddFarmerAsIndividual_UniqueDetails_HappyFlow() { FarmerDetails farmer = new FarmerDetails { FarmerId = 6789, User = new Users() { UserFullName = "clary", PhoneNumber = "8967569878", Email = "*****@*****.**", Location = "Hyderabad", Password = "******", UserRole = 1 } }; _orchard1Context.Users.Add(FarmerTestData()); _orchard1Context.SaveChanges(); var result = await farmerRepository.AddFarmerRegistrationDetails(farmer); Assert.AreEqual("Successfull", result); }