public ConsumerFullViewModel(Consumer model) { CustomMapper.MapEntity(model, this); if (model.Advocate != null) { this.AdvocateName = model.Advocate.LastName + ", " + model.Advocate.FirstName; } if (model.AdvocatePaper != null) { this.AdvocatePaperName = model.AdvocatePaper.LastName + ", " + model.AdvocatePaper.FirstName; } if (this.Status.HasValue) { this.StatusName = model.List.ListDescription; } this.DateOfBirth = (model.DateOfBirth != null ? DateTime.SpecifyKind(model.DateOfBirth.Value, DateTimeKind.Unspecified) : model.DateOfBirth); this.HasServiceCoordinator = model.HasServiceCoordinator.HasValue ? model.HasServiceCoordinator.Value : false; this.CH = new Contact(model.CHCoordinatorId, model.CHCoordinator); this.DH = new Contact(model.DHCoordinatorId, model.DHCoordinator); this.MSC = new Contact(model.MSCId, model.MSCoordinator); this.ServiceCoordinator = new Contact(model.ServiceCoordinatorId, model.ServiceCoordinatorContact); this.ServiceCoordinators = CustomMapper.MapList <ConsumerServiceCoordinatorViewModel, ConsumerServiceCoordinator>(model.ConsumerServiceCoordinators.ToList()); this.Addresses = CustomMapper.MapList <ConsumerAddressModelView, ConsumerAddress>(model.ConsumerAddresses.ToList()); this.MedicaidNumbers = CustomMapper.MapList <ConsumerMedicaidNumberViewModel, ConsumerMedicaidNumber>(model.ConsumerMedicaidNumbers.ToList()); }
public async Task <JsonResult> GetDeletedFiles() { long userId = long.Parse(User.Identity.Name); var Entities = await _fileManager.GetDeletedFiles(userId); List <DeletedFileDto> files = CustomMapper <FileEntity, DeletedFileDto> .MapList(Entities); return(new JsonResult(new ResponseModel(data: new { files }))); }
public static List <FileMetaDataModel> GetFilesByConsumerServicesId(int id) { using (RayimContext context = new RayimContext()) { var files = context.FileMetaDatas.Where(x => x.ParentEntityId == id && x.ParentEntityTypeId == (int)EntityTypes.ConsumerServices).ToList(); return(CustomMapper.MapList <FileMetaDataModel, FileMetaData>(files)); } }
public async Task <JsonResult> GetAll() { long userId = long.Parse(User.Identity.Name); var entities = await _userManager.GetAll(); List <UserDto> users = CustomMapper <UserEntity, UserDto> .MapList(entities.Where(u => u.Id != userId).ToList()); return(new JsonResult(new ResponseModel(message: "Success", data: users))); }
private List <ReportTemplateViewModel> GetFilteredReportTemplates(List <ReportTemplateModel> templates, DateTime?reportDate) { var mappedList = CustomMapper.MapList <ReportTemplateViewModel, ReportTemplateModel>(templates); mappedList.ForEach(template => { template.IsSelected = ReportManager.IsReportTemplateApplied(reportDate, template);; }); return(mappedList); }
public async Task <JsonResult> GetAll() { long userId = long.Parse(User.Identity.Name); var Entities = await _fileManager.GetAll(userId); if (Entities == null) { return(new JsonResult(new ResponseModel())); } List <DirectoryDto> files = CustomMapper <FileEntity, DirectoryDto> .MapList(Entities); return(new JsonResult(new ResponseModel(data: new { files }))); }
public static List <AuditModel> GetAudits(RayimContext context, DateTime?auditDate = null) { var dbAudits = context.Audits.Where(x => auditDate == null || x.AuditDate <= auditDate).ToList(); var modelAudits = dbAudits.Select(x => { var result = CustomMapper.MapEntity <AuditModel>(x); result.Consumers = CustomMapper.MapList <ConsumerModel, Database.Consumer>(x.Consumers.ToList()); return(result); }).ToList(); return(modelAudits); }
public async Task <ConsumerServiceModel> GetService(int serviceId, bool withRelatedData = false) { var service = await _context.ConsumerServices.FirstOrDefaultAsync(x => x.ConsumerServiceId == serviceId); ConsumerServiceModel returnData = CustomMapper.MapEntity <ConsumerServiceModel>(service); if (withRelatedData && service != null && service.ConsumerId != null) { ConsumerEmployeeManagement manageEmployees = new ConsumerEmployeeManagement(_context); var employees = await manageEmployees.GetEmployees(service.ConsumerId.Value, service.ServiceId); returnData.ConsumerEmployeeList = CustomMapper.MapList <ConsumerEmployeeModel, ConsumerEmployee>(employees); } return(returnData); }
public async Task <ActionResult> SendEmail(int serviceId, String email, string emailBody, String contactName) { if (User == null) { return(null); } ConsumerServicesManagement manage = new ConsumerServicesManagement(_context); var service = await manage.GetService(serviceId, true); var mappedData = CustomMapper.MapEntity <ConsumerServiceModel, ApprovedServiceBoundModel>(service); mappedData.ConsumerEmployeeList = CustomMapper.MapList <ConsumerEmployeeModel, ConsumerEmployeeModel>(service.ConsumerEmployeeList); mappedData.InnerEmailBody = emailBody; List <Object> emailInputData = new List <object>() { mappedData }; await EmailService.SendBoundEmail(email, contactName, "Approver Service Email", "apporved-service-email", emailInputData, User?.Identity?.Name); return(Json(new { status = "ok" })); }
public async Task <JsonResult> GetSharedFiles() { long userId = long.Parse(User.Identity.Name); var sharedFiles = (await _sharedFileManager.GetAll(userId)).ToList(); var user = await _userManager.GetAsync(u => u.Id == userId); var files = new List <FileEntity>(); foreach (var entity in sharedFiles) { files.Add(entity.File); } List <SharedFileDto> entities = CustomMapper <FileEntity, SharedFileDto> .MapList(files); entities.ForEach(x => { x.Duration = Dir.GetVideoDuration(Path.Combine(_env.WebRootPath, x.Path)); x.Owner = CustomMapper <UserEntity, UserDto> .Map(_userManager.GetAsync(u => u.Id == x.UserId).Result); x.Size = new FileInfo(Path.Combine(_env.WebRootPath, x.Path)).Length / Math.Pow(1024, 2); }); return(new JsonResult(new ResponseModel(message: "Success", data: new { files = entities }))); }
public static List <FileMetaDataModel> GetConsumerFiles(RayimContext context, int consumerId) { var dbFiles = context.FileMetaDatas.Where(x => x.ParentEntityId == consumerId && x.ParentEntityTypeId == (int)EntityTypes.Consumer).ToList(); return(CustomMapper.MapList <FileMetaDataModel, FileMetaData>(dbFiles)); }
public void SetUploadFiles(List <FileMetaDataModel> uploadFiles) { this.UploadFiles = CustomMapper.MapList <FileMetaDataModelView, FileMetaDataModel>(uploadFiles); }