Exemplo n.º 1
0
        //[Fact]
        public void CreateAndUpdate()
        {
            const string connectionString = "";
            var          id      = Guid.NewGuid();
            var          address = new Address("Faux House", "Imaginary Street", "Scum on the Wold", "Widgetshire", "AB12 3CD");

            using (IUnitOfWork u = new UnitOfWork(new SqlConnection(connectionString)))
            {
                var eventStore         = new SqlEventStore(new DictionaryBackedEventPublisher(), u);
                var landlordRepository = new LandlordRepository(eventStore);
                var l = Landlord.Create(id, new Name("Bob", "Rocket"), "*****@*****.**", address);
                landlordRepository.Save(l, 0);
                u.Commit();
            }

            using (IUnitOfWork u = new UnitOfWork(new SqlConnection(connectionString)))
            {
                var eventStore         = new SqlEventStore(new DictionaryBackedEventPublisher(), u);
                var landlordRepository = new LandlordRepository(eventStore);
                var l = landlordRepository.Get(id);
                l.ChangeName(new Name("Peter", "Crabkin"));
                landlordRepository.Save(l, 1);
                u.Commit();
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,FIO,Email,Phone,PhotoPath,fromTime,toTime")] Landlord landlord)
        {
            if (id != landlord.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(landlord);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LandlordExists(landlord.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(landlord));
        }
 public void Teardown()
 {
     this.test    = null;
     this.options = null;
     this.newProp = null;
     this.pA      = null;
 }
Exemplo n.º 4
0
        public override void Handle(DatabaseUpdateCommand command)
        {
            command.Document.AssertClusterDatabase();

            var key = DatabaseHelper.GetDatabaseKey(command.Document.Id);

            var documentJson = Database.Documents.Get(key, null);

            if (documentJson != null)
            {
                var document = documentJson.DataAsJson.JsonDeserialization <DatabaseDocument>();
                if (document.IsClusterDatabase() == false)
                {
                    log.Error(string.Format("Local database '{0}' is not cluster-wide.", DatabaseHelper.GetDatabaseName(command.Document.Id)));
                    return;
                }
            }

            Landlord.Protect(command.Document);
            var json = RavenJObject.FromObject(command.Document);

            json.Remove("Id");

            try
            {
                Database.Documents.Put(key, null, json, new RavenJObject(), null);
            }
            catch (OperationVetoedException e)
            {
                log.ErrorException("Was not able to update resorce due to veto", e);
            }
        }
Exemplo n.º 5
0
        // GET: api/Landlord/5
        public IHttpActionResult Get(int id)
        {
            Landlord lord   = this.ldal.GetLord(id);
            string   status = lord != null ? Utils.success : Utils.failure;

            return(Ok(Utils.createResponce(status, lord)));
        }
Exemplo n.º 6
0
        public Landlord AddLandlord(string surname, string firstname, string middlename, string phone, string email,
                                    string country, string city, string street, string building, string index,
                                    string inn, string ogrn, string bankAccaunt)
        {
            Landlord p = new Landlord
            {
                Surname    = surname,
                FirstName  = firstname,
                MiddleName = middlename,
                Phone      = phone,
                Email      = email,

                Adress =
                {
                    Country = country,
                    City    = city,
                    Street  = street,
                    Bilding = building,
                    Index   = index
                },

                INN         = inn,
                OGRN        = ogrn,
                BankAccount = bankAccaunt,
            };

            cont.Person.Add(p);
            cont.SaveChanges();
            return(p);
        }
Exemplo n.º 7
0
        private DisplayContract CopyHomeAndLandlord(House home, Landlord landlord)
        {
            var ShowContract = new DisplayContract
            {
                Id               = home.Id,
                Address1         = home.Address1,
                Address2         = home.Address2,
                Address3         = home.Address3,
                Address4         = home.Address4,
                Address5         = home.Address5,
                Tenant1          = home.Tenant1,
                Tenant2          = home.Tenant2,
                DateFrom         = home.DateFrom,
                DateTo           = home.DateTo,
                LandlordId       = home.LandlordId,
                Rent             = home.Rent,
                Deposit          = home.Deposit,
                Mobile           = home.Mobile,
                Email            = home.Email,
                LandlordName     = landlord.Name,
                LandlordAddress1 = landlord.Address1,
                LandlordAddress2 = landlord.Address2,
                LandlordAddress3 = landlord.Address3,
                LandlordAddress4 = landlord.Address4,
                LandlordAddress5 = landlord.Address5,
            };

            return(ShowContract);
        }
Exemplo n.º 8
0
        public Branch EditBranch(int id, string website, string phone, DateTime startWorkingTime, DateTime endtWorkingTime,
                                 string country, string city, string street, string building, string index,
                                 CompanyOwner owner, Landlord landlord)
        {
            Branch b = cont.Branch.SingleOrDefault(ca => ca.Id == id);

            b.WebSite          = website;
            b.Phone            = phone;
            b.StartWorkingTime = new TimeSpan(startWorkingTime.Hour, startWorkingTime.Minute, startWorkingTime.Second);
            b.EndWorkingTime   = new TimeSpan(endtWorkingTime.Hour, endtWorkingTime.Minute, endtWorkingTime.Second);

            b.Adress = new Adress
            {
                Country = country,
                City    = city,
                Street  = street,
                Bilding = building,
                Index   = index
            };

            b.Owner    = owner;
            b.Landlord = landlord;

            cont.SaveChanges();
            return(b);
        }
Exemplo n.º 9
0
        public Branch AddBranch(string website, string phone, DateTime startWorkingTime, DateTime endtWorkingTime,
                                string country, string city, string street, string building, string index,
                                CompanyOwner owner, Landlord landlord)
        {
            Branch b = new Branch
            {
                WebSite          = website,
                Phone            = phone,
                StartWorkingTime = new TimeSpan(startWorkingTime.Hour, startWorkingTime.Minute, startWorkingTime.Second),
                EndWorkingTime   = new TimeSpan(endtWorkingTime.Hour, endtWorkingTime.Minute, endtWorkingTime.Second),

                Adress =
                {
                    Country = country,
                    City    = city,
                    Street  = street,
                    Bilding = building,
                    Index   = index
                },

                Owner    = owner,
                Landlord = landlord,
            };

            cont.Branch.Add(b);
            cont.SaveChanges();
            return(b);
        }
Exemplo n.º 10
0
        public UserDto Register(RegistrationRequestDto dto, SaltedHashResult auth)
        {
            var tenant = new Landlord()
            {
                LandlordUser = new User()
                {
                    EmailAddress = dto.EmailAddress,
                    FirstName = dto.FirstName,
                    LastName = dto.LastName,
                    DateOfBirth = dto.DateOfBirth,
                    DateRegistered = DateTime.UtcNow,
                    Authentication = new UserAuthentication()
                    {
                        PasswordHash = auth.Hash,
                        PasswordSalt = auth.Salt
                    },
                    Role = dto.Role
                }
            };

            _entities.Landlords.Add(tenant);
            _entities.SaveChanges();

            return tenant.LandlordUser.ToDto();
        }
Exemplo n.º 11
0
        public Landlord Update(Landlord updatedLandlord)
        {
            deleteById(updatedLandlord.LanlordId);
            Landlords.Add(updatedLandlord);

            return(updatedLandlord);
        }
Exemplo n.º 12
0
        public void AddLandlord(LandlordsBindingModel landlordBindingModel)
        {
            Landlord landlord = Mapper.Map <Landlord>(landlordBindingModel);

            this.Context.Landlords.Add(landlord);
            this.Context.SaveChanges();
        }
Exemplo n.º 13
0
        public ActionResult Create(LandlordAddressViewModel theVM)
        {
            string   uniqueFileName = UploadedFile(theVM);
            Image    newImage       = new Image();
            Address  newAddress     = new Address();
            Landlord newLandlord    = new Landlord();
            var      userId         = this.User.FindFirstValue(ClaimTypes.NameIdentifier);

            newLandlord.IdentityUserId = userId;
            _repo.Image.CreateImage(newImage);
            _repo.Landlord.CreateLandlord(newLandlord);
            newLandlord.IdentityUserId = userId;
            newLandlord.FirstName      = theVM.FirstName;
            newLandlord.LastName       = theVM.LastName;
            newLandlord.CompanyName    = theVM.CompanyName;
            newLandlord.Email          = theVM.Email;
            newLandlord.PhoneNumber    = theVM.PhoneNumber;
            newLandlord.Address        = newAddress;
            newAddress.StreetAddress   = theVM.StreetAddress;
            newAddress.City            = theVM.City;
            newAddress.State           = theVM.State;
            newAddress.Zipcode         = int.Parse(theVM.ZipCode);
            newImage.ProfileImage      = uniqueFileName;
            newLandlord.ProfileImage   = uniqueFileName;
            _repo.Save();
            try
            {
                return(RedirectToAction(nameof(Index)));
            }
            catch
            {
                return(View());
            }
        }
        public override void Handle(DatabaseDeletedCommand command)
        {
            var key = DatabaseHelper.GetDatabaseKey(command.Name);

            var documentJson = Database.Documents.Get(key);

            if (documentJson == null)
            {
                return;
            }

            var document = documentJson.DataAsJson.JsonDeserialization <DatabaseDocument>();

            if (document.IsClusterDatabase() == false)
            {
                return; // ignore non-cluster databases
            }
            var configuration = Landlord.CreateTenantConfiguration(DatabaseHelper.GetDatabaseName(command.Name), true);

            if (configuration == null)
            {
                return;
            }

            Database.Documents.Delete(key, null, null);

            if (command.HardDelete)
            {
                DatabaseHelper.DeleteDatabaseFiles(configuration);
            }
        }
Exemplo n.º 15
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,IdentityUserId,FirstName,LastName,PhoneNumber")] Landlord landlord)
        {
            if (id != landlord.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(landlord);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!LandlordExists(landlord.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["IdentityUserId"] = new SelectList(_context.Users, "Id", "Id", landlord.IdentityUserId);
            return(View(landlord));
        }
Exemplo n.º 16
0
        public int RagisterLandlord(Landlord lord)
        {
            con.Open();
            MySqlTransaction transaction = con.BeginTransaction();

            try
            {
                string       queryformat = "insert into login(email,password,role) values('{0}','{1}','L')";
                string       Query       = string.Format(queryformat, lord.email, lord.password);
                MySqlCommand cmd         = new MySqlCommand(Query, con, transaction);
                int          RowAffected = cmd.ExecuteNonQuery();



                string queryformat2 = "INSERT INTO landlord(fname,lname,gender,mobno1,mobno2,city,vid) ";
                queryformat2 += "VALUES('{0}','{1}','{2}','{3}','{4}','{5}', (SELECT vid FROM login WHERE email='{6}'))";

                string Query2 = string.Format(queryformat2, lord.fname, lord.lname, lord.gender, lord.mobno1, lord.mobno2,
                                              lord.city, lord.email);
                MySqlCommand cmd2         = new MySqlCommand(Query2, con, transaction);
                int          RowAffected2 = cmd2.ExecuteNonQuery();
                transaction.Commit();
                con.Close();
                return(RowAffected);
            }
            catch
            {
                transaction.Rollback();
                con.Close();
                return(0);
            }
        }
Exemplo n.º 17
0
        /// <summary>
        /// If the selection of the Properties grid changes refresh Property.
        /// </summary>
        /// <param name="property"></param>
        /// <param name="e"></param>
        private void PropertiesViewModel_OnPropertyChanged(Property property, EventArgs e)
        {
            if (property == null)
            {
                _title    = "Add Property";
                _property = new Property()
                {
                    AvailableFrom = DateTime.Now,
                    LandlordId    = 0
                };
            }
            else
            {
                _title    = "Edit Property";
                _property = new Property()
                {
                    PropertyId    = property.PropertyId,
                    Housenumber   = property.Housenumber,
                    Street        = property.Street,
                    Town          = property.Town,
                    PostCode      = property.PostCode,
                    Status        = property.Status,
                    AvailableFrom = property.AvailableFrom,
                    LandlordId    = property.LandlordId,
                    Landlord      = property.Landlord
                };

                _selectedLandlord = _property.Landlord;
            }

            RaisePropertyChangedEvent(nameof(Title));
            RaisePropertyChangedEvent(nameof(Property));
            RaisePropertyChangedEvent(nameof(SelectedLandlord));
        }
        public async Task <string> Handle(
            CreateLandlordRequest request,
            CancellationToken cancellationToken)
        {
            _logger.LogInformation($"Creating Landlord: {request.Email}");

            var validationResult = await _validator.ValidateAsync(request);

            if (!validationResult.IsValid)
            {
                _logger.LogWarning($"Invalid Landlord: {request.Email}");
                throw new ValidationException(validationResult.Errors);
            }

            var landlord = new Landlord()
            {
                Id             = Guid.NewGuid().ToString(),
                Title          = request.Title.CapitalizeFirstLetter(),
                FirstName      = request.FirstName.CapitalizeFirstLetter(),
                MiddleNames    = request.MiddleNames.CapitalizeFirstLetter(),
                LastName       = request.LastName.CapitalizeFirstLetter(),
                Email          = request.Email,
                MobilePhone    = request.MobilePhone,
                HomePhone      = request.HomePhone,
                RegsiterNumber = request.RegisterNumber,
                Dob            = request.Dob,
                ActiveStatus   = ActiveStatus.ACTIVE
            };

            _context.Landlords.Add(landlord);
            await PublishLandlordCreatedNotification(landlord.Id);

            _logger.LogWarning($"Landlord Created: {landlord.Email}");
            return(landlord.Id);
        }
Exemplo n.º 19
0
        public IHttpActionResult RagisterLord([FromBody] Landlord lord)
        {
            int    rows   = rd.RagisterLandlord(lord);
            string status = (rows > 0) ? Utils.success : Utils.failure;

            return(Ok(Utils.createResponce(status, rows)));
        }
Exemplo n.º 20
0
        public Person EditPerson(int id, string surname, string firstname, string middlename, string phone, string email,
                                 string country, string city, string street, string building, string index,
                                 string inn, string ogrn, string bankAccaunt)
        {
            Landlord p = (Landlord)cont.Person.SingleOrDefault(ca => ca.Id == id);

            p.Surname    = surname;
            p.FirstName  = firstname;
            p.MiddleName = middlename;
            p.Phone      = phone;
            p.Email      = email;

            p.Adress = new Adress
            {
                Country = country,
                City    = city,
                Street  = street,
                Bilding = building,
                Index   = index
            };

            p.INN         = inn;
            p.OGRN        = ogrn;
            p.BankAccount = bankAccaunt;

            cont.SaveChanges();
            return(p);
        }
Exemplo n.º 21
0
        public ActionResult DeleteConfirmed(int id)
        {
            Landlord landlord = db.Landlords.Find(id);

            db.Landlords.Remove(landlord);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 22
0
        public async Task <Landlord> AddLandlord(Landlord landlord)
        {
            var result = await _apiClient.PostAsJsonAsync("/api/Landlords/AddLandlord", landlord);

            var Resultlandlord = await result.Content.ReadFromJsonAsync <Landlord>();

            return(Resultlandlord);
        }
Exemplo n.º 23
0
        public string CreateLandlord(Landlord landlord)
        {
            Check.If(landlord).IsNotNull();

            var result = _landlordRepository.CreateLandlord(landlord.CreateReference(_referenceGenerator));

            return result ? landlord.LandlordReference : null;
        }
Exemplo n.º 24
0
 public TaxCase(Invoice invoice, Tenant tenant, Property property, Landlord landlord, Rent rent)
 {
     _invoice  = invoice;
     _tenant   = tenant;
     _property = property;
     _landlord = landlord;
     _rent     = rent;
     prepareProperTaxValues();
 }
        /* new action to be deleted if not working VV */
        protected async Task <InvoiceFile> GetGeneratedPDF(int id)
        {
            try
            {
                var invoiceWithAll = await _repositoryWrapper.Invoice.GetInvoiceWihtAllDetailsForInvoiceGeneration(id);

                // Add Application user to get access for email data
                ApplicationUser landlordAspUser = invoiceWithAll.Rent.Landlord.ApplicationUser;
                ApplicationUser tenantAspUser   = invoiceWithAll.Rent.Tenant.ApplicationUser;
                Invoice         invoice         = _mapper.Map <Invoice>(invoiceWithAll);
                Rent            rent            = _mapper.Map <Rent>(invoiceWithAll.Rent);
                Tenant          tenant          = _mapper.Map <Tenant>(invoiceWithAll.Rent.Tenant);
                Property        property        = _mapper.Map <Property>(invoiceWithAll.Rent.Property);
                Landlord        landlord        = _mapper.Map <Landlord>(invoiceWithAll.Rent.Landlord);
                Photo           photo           = _mapper.Map <Photo>(invoiceWithAll.State.Photo);
                Rate            rate            = _mapper.Map <Rate>(invoiceWithAll.Rent.Property.Rate);

                var globalSettings = new GlobalSettings
                {
                    ColorMode   = ColorMode.Color,
                    Orientation = Orientation.Portrait,
                    PaperSize   = PaperKind.A4,
                    Margins     = new MarginSettings {
                        Top = 10
                    },
                    DocumentTitle = "Invoice title",
                };

                InvoiceFile invoiceGenerated = TemplateGenerator.GetInvoiceHTMLString(landlordAspUser, tenantAspUser, invoice, tenant, property, landlord, rent);

                var objectSettings = new ObjectSettings
                {
                    PagesCount     = true,
                    HtmlContent    = invoiceGenerated.getInvoiceString(),
                    WebSettings    = { DefaultEncoding = "utf-8", UserStyleSheet = SystemRecognizer.GetCssFileLocation() },
                    HeaderSettings = { FontName = "Arial", FontSize = 9, Right = "Page [page] of [toPage]", Line = true },
                    FooterSettings = { FontName = "Arial", FontSize = 9, Line = true, Center = "Report Footer" }
                };

                var pdf = new HtmlToPdfDocument()
                {
                    GlobalSettings = globalSettings,
                    Objects        = { objectSettings }
                };

                byte[] file = _converter.Convert(pdf);

                invoiceGenerated.setInvoiceBytes(file);

                return(invoiceGenerated);
            }
            catch (Exception e)
            {
                _logger.LogError($"Something went wrong inside ViewOnWebPDF(id) action: {e.ToString()}");
                return(null);
            }
        }
Exemplo n.º 26
0
        public static void Initialize(LettingsManagerContext context, IWebHostEnvironment webHostEnvironment)
        {
            //context.Database.EnsureCreated();



            if (context.Landlords.Any())
            {
                return;   // DB has been seeded
            }
            var landlords = GetLandlord(webHostEnvironment);

            foreach (var land in landlords)
            {
                var l = new Landlord
                {
                    Name     = land.Name,
                    Address1 = land.Address1,
                    Address2 = land.Address2,
                    Address3 = land.Address3,
                    Address4 = land.Address4,
                    Address5 = land.Address5,
                    Mobile   = land.Mobile,
                    Email    = land.Email
                };

                context.Landlords.Add(l);
            }

            context.SaveChanges();
            var houses = GetHouses(webHostEnvironment);

            foreach (var house in houses)
            {
                var h = new House
                {
                    Address1   = house.Address1,
                    Address2   = house.Address2,
                    Address3   = house.Address3,
                    Address4   = house.Address4,
                    Address5   = house.Address5,
                    Tenant1    = house.Tenant1,
                    Tenant2    = house.Tenant2,
                    DateFrom   = house.DateFrom,
                    DateTo     = house.DateTo,
                    LandlordId = house.LandlordId,
                    Rent       = house.Rent,
                    Deposit    = house.Deposit,
                    Mobile     = house.Mobile,
                    Email      = house.Email
                };
                context.Houses.Add(h);
            }

            context.SaveChanges();
        }
Exemplo n.º 27
0
        public Guid SaveLandload(int baseHouseId)
        {
            Guid landlordId;

            List <BaseHouse> dormHouses = BaseHouseDAO.SelectAllByHouseTypeId(HouseTypeId);

            CurrentHouse = dormHouses.Find(bh => bh.BaseHouseId == baseHouseId);
            if (CurrentHouse.LandlordId.HasValue)
            {
                landlordId = CurrentHouse.LandlordId.Value;
            }
            else
            {
                aspnet_Roles aspnet_Roles_ = new aspnet_Roles();
                Landlord     landload      = new Landlord();
                aspnet_Roles_ = aspnet_Roles.Select("landlord");

                User Landlorduser = new User();

                Landlorduser.UserId = Guid.NewGuid();
                landlordId          = Landlorduser.UserId.Value;

                Landlorduser.PersonalEmail     = CurrentHouse.ManagerEmail;
                Landlorduser.FirstName         = CurrentHouse.PropertyManagementCompanyName;
                Landlorduser.BestContactNumber = CurrentHouse.PhoneNumber;
                Landlorduser.CreatedBy         = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
                Landlorduser.UpdatedBy         = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
                Landlorduser.IsPartialUser     = true;
                Landlorduser.RoleId            = aspnet_Roles_.RoleId;
                Landlorduser.UpdatedDate       = DateTime.Now;

                if (Landlorduser.Save())
                {
                    landload.user           = Landlorduser;
                    landload.LandlordId     = Landlorduser.UserId.Value;
                    landload.LandlordName   = Landlorduser.FirstName;
                    landload.IsDeleted      = false;
                    landload.LandlordTypeId = (int)Enums.LandlordType.CorporateLandlord;
                    landload.CreatedBy      = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());
                    landload.UpdatedBy      = Guid.Parse(Membership.GetUser().ProviderUserKey.ToString());

                    if (landload.Save())
                    {
                        //Todo: Update the basehouse table with the new LandlordId
                        CurrentHouse.LandlordId = landlordId;
                        CurrentHouse.CreatedBy  = Membership.GetUser().UserName;
                        CurrentHouse.UpdatedBy  = Membership.GetUser().UserName;
                        if (CurrentHouse.Save())
                        {
                            //Base House is updated with new landlord id
                        }
                    }
                }
            }
            return(landlordId);
        }
Exemplo n.º 28
0
        public Landlord Create(Landlord newLandlord)
        {
            Guid g = new Guid();

            newLandlord.Id = g.ToString();
            // newLandlord.Id = Landlord.OrderByDescending(l => l.Id).Single().Id + 1;
            Landlords.Add(newLandlord);

            return(newLandlord);
        }
Exemplo n.º 29
0
        public IActionResult GetLandlordById(int id)
        {
            Landlord Landlord = LandlordDB.GetEntity(id);

            if (Landlord == null)
            {
                return(NotFound());
            }
            return(new ObjectResult(Landlord));
        }
Exemplo n.º 30
0
 public ActionResult Edit([Bind(Include = "LandlordId,FirstName,SecondName,MobileNumber")] Landlord landlord)
 {
     if (ModelState.IsValid)
     {
         db.Entry(landlord).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(landlord));
 }
Exemplo n.º 31
0
 public IActionResult CreateLandlord([FromBody] Landlord Landlord)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest());
     }
     LandlordDB.Create(Landlord);
     LandlordDB.Save();
     return(Ok(Landlord));
 }
Exemplo n.º 32
0
 public IActionResult UpdateLandlord([FromBody] Landlord Landlord)
 {
     if (Landlord == null)
     {
         return(BadRequest());
     }
     LandlordDB.Update(Landlord);
     LandlordDB.Save();
     return(Ok(Landlord));
 }
        public void LandlordMapper_DoesNotMap_DateDeleted()
        {
            //arrange
            var dateDeleted = DateTime.Now;
            var landlord1 = new Landlord { DateDeleted = dateDeleted };
            var landlord2 = new Landlord { DateDeleted = DateTime.MinValue };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.DateDeleted.Should().Be(dateDeleted);
        }
        public void LandlordMapper_Maps_AddressLine1()
        {
            //arrange
            const string addressLine1 = "This is a test value";
            var landlord1 = new Landlord { AddressLine1 = string.Empty };
            var landlord2 = new Landlord { AddressLine1 = addressLine1 };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.AddressLine1.Should().Be(addressLine1);
        }
        public void LandlordMapper_DoesNotMap_LandlordReference()
        {
            //arrange
            const string reference = "ABCD1234";
            var landlord1 = new Landlord { LandlordReference = reference };
            var landlord2 = new Landlord { LandlordReference = string.Empty };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.LandlordReference.Should().Be(reference);
        }
        public void LandlordMapper_DoesNotMap_LandlordId()
        {
            //arrange
            const int id = 123;
            var landlord1 = new Landlord { LandlordId = id };
            var landlord2 = new Landlord { LandlordId = 0 };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.LandlordId.Should().Be(id);
        }
Exemplo n.º 37
0
        public static LandlordSummary BuildLandlordSummary(Landlord landlord)
        {
            Check.If(landlord).IsNotNull();

            var result = new LandlordSummary
            {
                LandlordReference = landlord.LandlordReference,
                Mobile = landlord.Mobile,
                Email = landlord.Email,
                FamilyName = landlord.FamilyName,
                GivenName = landlord.GivenName,
                KnownAs = landlord.KnownAs
            };
            return result;
        }
        public void LandlordMapper_Maps_GivenName()
        {
            //arrange
            const string givenName = "This is a test value";
            var landlord1 = new Landlord { GivenName = string.Empty };
            var landlord2 = new Landlord { GivenName = givenName };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.GivenName.Should().Be(givenName);
        }
 public bool UpdateLandlord(string landlordReference, Landlord landlord)
 {
     return _propertyService.UpdateLandlord(landlordReference, landlord);
 }
 public string CreateLandlord(Landlord landlord)
 {
     return _propertyService.CreateLandlord(landlord);
 }
        public void LandlordMapper_Maps_Mobile()
        {
            //arrange
            const string mobile = "07793123456";
            var landlord1 = new Landlord { Mobile = "0" };
            var landlord2 = new Landlord { Mobile = mobile };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.Mobile.Should().Be(mobile);
        }
        public void LandlordMapper_Maps_Postcode()
        {
            //arrange
            const string postcode = "This is a test value";
            var landlord1 = new Landlord { Postcode = string.Empty };
            var landlord2 = new Landlord { Postcode = postcode };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.Postcode.Should().Be(postcode);
        }
Exemplo n.º 43
0
        public bool UpdateLandlord(string landlordReference, Landlord landlord)
        {
            var existingLandlord =
                _propertiesContext.Landlords.Active().FirstOrDefault(x => x.LandlordReference == landlordReference);

            if (existingLandlord == null) return false;

            var isDirty = _landlordMapper.Map(landlord, existingLandlord);

            return !isDirty || _propertiesContext.SaveChanges() > 0;
        }
Exemplo n.º 44
0
        public bool UpdateLandlord(string landlordReference, Landlord landlord)
        {
            Check.If(landlordReference).IsNotNullOrEmpty();
            Check.If(landlord).IsNotNull();

            return _landlordRepository.UpdateLandlord(landlordReference, landlord);
        }
Exemplo n.º 45
0
        public bool CreateLandlord(Landlord landlord)
        {
            _propertiesContext.Landlords.Add(landlord);

            return _propertiesContext.SaveChanges() > 0;
        }
        public void LandlordMapper_Maps_County()
        {
            //arrange
            const string county = "This is a test value";
            var landlord1 = new Landlord { County = string.Empty };
            var landlord2 = new Landlord { County = county };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.County.Should().Be(county);
        }
        public void LandlordMapper_Maps_Landline()
        {
            //arrange
            const string landline = "01234567890";
            var landlord1 = new Landlord { Landline = "0" };
            var landlord2 = new Landlord { Landline = landline };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.Landline.Should().Be(landline);
        }
        public void LandlordMapper_Maps_FamilyName()
        {
            //arrange
            const string familyName = "This is a test value";
            var landlord1 = new Landlord { FamilyName = string.Empty };
            var landlord2 = new Landlord { FamilyName = familyName };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.FamilyName.Should().Be(familyName);
        }
        public void LandlordMapper_Maps_KnownAs()
        {
            //arrange
            const string knownAs = "This is a test value";
            var landlord1 = new Landlord { KnownAs = string.Empty };
            var landlord2 = new Landlord { KnownAs = knownAs };

            //act
            _landlordMapper.Map(landlord2, landlord1);

            //assert
            landlord1.KnownAs.Should().Be(knownAs);
        }