public virtual void Copy(IBaseDto dto) { if (dto.GetType() == typeof(BaseFilmDto)) { var that = (BaseFilmDto)dto; Title = that.Title; Year = that.Year; Length = that.Length; } }
public virtual void Copy(IBaseDto dto) { if (dto.GetType() == typeof(BasePersonDto)) { var that = (BasePersonDto)dto; FirstMidName = that.FirstMidName; LastName = that.LastName; Birthdate = that.Birthdate; } }
public virtual void Copy(IBaseDto dto) { if (dto.GetType() == typeof(BaseFilmPersonDto)) { var that = (BaseFilmPersonDto)dto; Title = that.Title; Year = that.Year; LastName = that.LastName; Birthdate = that.Birthdate; Role = that.Role; } }
public virtual void Copy(IBaseDto dto) { if (dto.GetType() == typeof(BaseMediumDto)) { var that = (BaseMediumDto)dto; Title = that.Title; Year = that.Year; MediumType = that.MediumType; Location = that.Location; HasGermanSubtitles = that.HasGermanSubtitles; } }
public virtual bool Equals(IBaseDto dto) { var result = false; if (dto.GetType() == typeof(BaseFilmDto)) { var that = (BaseFilmDto)dto; result = Title.Equals(that.Title) && Year.Equals(that.Year) && Length.Equals(that.Length); } return(result); }
public virtual bool Equals(IBaseDto dto) { var result = false; if (dto.GetType() == typeof(BasePersonDto)) { var that = (BasePersonDto)dto; result = FirstMidName.Equals(that.FirstMidName) && LastName.Equals(that.LastName) && Birthdate.Equals(that.Birthdate); } return(result); }
public virtual bool Equals(IBaseDto dto) { var result = false; if (dto.GetType() == typeof(BaseMediumDto)) { var that = (BaseMediumDto)dto; result = Title.Equals(that.Title) && Year.Equals(that.Year) && MediumType.Equals(that.MediumType) && Location.Equals(that.Location); } return(result); }
public virtual bool Equals(IBaseDto dto) { var result = false; if (dto.GetType() == typeof(BaseFilmPersonDto)) { var that = (BaseFilmPersonDto)dto; result = Title.Equals(that.Title) && Year.Equals(that.Year) && LastName.Equals(that.LastName) && Birthdate.Equals(that.Birthdate) && Role.Equals(that.Role); } return(result); }
public IEntity MapToModel(IBaseDto entity) { if (entity == null) { throw new FormatException(); } var dtoTypeName = entity.GetType().Name; switch (dtoTypeName) { case "OrderDto": { var dtoEntity = (OrderDto)entity; return(new Order() { Id = dtoEntity.Id, StartDate = dtoEntity.StartDate, EndDate = dtoEntity.EndDate, Sum = dtoEntity.Sum, CustomerId = dtoEntity.CustomerId, ManagerId = dtoEntity.ManagerId }); } case "CustomerDto": { var dtoEntity = (CustomerDto)(IBaseDto)entity; return(new Customer() { Id = dtoEntity.Id, FirstName = dtoEntity.FirstName, LastName = dtoEntity.LastName, PhoneNumber = dtoEntity.PhoneNumber, PassportSeries = dtoEntity.PassportSeries, AccoutId = dtoEntity.AccoutId }); } case "CarDto": { var dtoEntity = (CarDto)(IBaseDto)entity; return(new Car() { Id = dtoEntity.Id, Brand = dtoEntity.Brand, Model = dtoEntity.Model, SerialNumber = dtoEntity.SerialNumber, Color = dtoEntity.Color, Price = dtoEntity.Price, ManufacturerId = dtoEntity.ManufacturerId }); } case "CarInOrderDto": { var dtoEntity = (CarInOrderDto)(IBaseDto)entity; return(new CarInOrder() { Id = dtoEntity.Id, OrderId = dtoEntity.OrderId, CarId = dtoEntity.CarId }); } case "ManagerDto": { var dtoEntity = (ManagerDto)(IBaseDto)entity; return(new Manager() { Id = dtoEntity.Id, FirstName = dtoEntity.FirstName, LastName = dtoEntity.LastName, PhoneNumber = dtoEntity.PhoneNumber, Salary = dtoEntity.Salary, Position = dtoEntity.Position }); } case "ManufacturerDto": { var dtoEntity = (ManufacturerDto)(IBaseDto)entity; return(new Manufacturer() { Id = dtoEntity.Id, Name = dtoEntity.Name, OfficePhoneNumber = dtoEntity.OfficePhoneNumber, Country = dtoEntity.Country }); } default: throw new NotSupportedException(); } }
public IEntity MapToModel(IBaseDto entity) { if (entity == null) { throw new FormatException(); } var dtoTypeName = entity.GetType().Name; switch (dtoTypeName) { case "GroupDto": { var groupDto = (GroupDto)entity; var id = groupDto.Id; var a = groupDto.GroupName; var x = groupDto.MaxStudents; var s = groupDto.StudyYear; return(new Group() { Id = groupDto.Id, GroupName = groupDto.GroupName, MaxStudents = groupDto.MaxStudents, StudyYear = groupDto.StudyYear }); } case "StudentDto": { var dtoEntity = (StudentDto)(IBaseDto)entity; return(new Student() { Id = dtoEntity.Id, FirstName = dtoEntity.FirstName, LastName = dtoEntity.LastName, PhoneNumber = dtoEntity.PhoneNumber, GroupId = dtoEntity.GroupId }); } case "SubjectDto": { var dtoEntity = (SubjectDto)(IBaseDto)entity; var enumInt = (int)dtoEntity.FinalTestType; return(new Subject() { Id = dtoEntity.Id, FinalTestType = (Model.FinalTestType)enumInt, Hours = dtoEntity.Hours, Name = dtoEntity.Name }); } case "SubjectInGroupDto": { var dtoEntity = (SubjectInGroupDto)(IBaseDto)entity; return(new SubjectInGroup() { Id = dtoEntity.Id, GroupId = dtoEntity.GroupId, SubjectId = dtoEntity.SubjectId }); } case "TeacherDto": { var dtoEntity = (TeacherDto)(IBaseDto)entity; return(new Teacher() { Id = dtoEntity.Id, FirstName = dtoEntity.FirstName, LastName = dtoEntity.LastName, PhoneNumber = dtoEntity.PhoneNumber, SubjectId = dtoEntity.SubjectId }); } case "TestDto": { var dtoEntity = (TestDto)(IBaseDto)entity; return(new Test() { Id = dtoEntity.Id, Date = dtoEntity.Date, Name = dtoEntity.Name, Theme = dtoEntity.Theme, TeacherId = dtoEntity.TeacherId }); } case "TestResultDto": { var dtoEntity = (TestResultDto)(IBaseDto)entity; return(new TestResult() { Id = dtoEntity.Id, Mark = dtoEntity.Mark, TestId = dtoEntity.TestId, StudentId = dtoEntity.StudentId }); } default: throw new NotSupportedException(); } }