//public List<AreaGridDto> GetList() //{ // var specification = new Specification<Area>(u => u.DeletedMark == false); // var sortingOtopns = new SortingOptions<Area, int?>(x => x.SortCode, isDescending: false); // var list = areaRepository.FindAll(specification, sortingOtopns).ToList(); // return Mapper.Map<List<AreaGridDto>>(list); //} //public AreaOutputDto GetForm(string keyValue) //{ // var id = Convert.ToInt64(keyValue); // AreaOutputDto areaOutputDto = new AreaOutputDto(); // Area area = areaRepository.Get(id); // AutoMapper.Mapper.Map<Area, AreaOutputDto>(area, areaOutputDto); // return areaOutputDto; //} public void SubmitForm(AttachInputDto attachInputDto, string keyValue) { Attach attach = new Attach(); if (!string.IsNullOrEmpty(keyValue)) { //var id = Convert.ToInt64(keyValue); //area = areaRepository.Get(id); //AutoMapper.Mapper.Map<AreaInputDto, Area>(areaInputDto, area); //area.LastModificationTime = DateTime.Now; //areaRepository.Update(area); } else { try { AutoMapper.Mapper.Map <AttachInputDto, Attach>(attachInputDto, attach); attach.Id = IdWorkerHelper.GenId64(); attach.CreationTime = DateTime.Now; attach.CreatorUserId = 1; attachRepository.Add(attach); } catch { AutoMapper.Mapper.Map <AttachInputDto, Attach>(attachInputDto, attach); attach.Id = IdWorkerHelper.GenId64(); attach.CreationTime = DateTime.Now; attach.CreatorUserId = 1; attachRepository.Add(attach); } } }
public void SaveAttach(string fileName, string fileType, string filePath, string thumbPath, string fileSize, string fileExt) { AttachService attachService = new AttachService(); AttachInputDto attachInputDto = new AttachInputDto(); attachInputDto.FileName = fileName; attachInputDto.FileType = fileType; attachInputDto.FilePath = filePath; attachInputDto.FileSize = Convert.ToInt64(fileSize); attachInputDto.FileExt = fileExt; attachInputDto.ThumbPath = thumbPath; attachService.SubmitForm(attachInputDto, ""); }
public void SubmitForm(AttachInputDto attachInputDto, string keyValue) { Attach attach = new Attach(); if (!string.IsNullOrEmpty(keyValue)) { //var id = Convert.ToInt64(keyValue); //area = areaRepository.Get(id); //AutoMapper.Mapper.Map<AreaInputDto, Area>(areaInputDto, area); //area.LastModificationTime = DateTime.Now; //areaRepository.Update(area); } else { AutoMapper.Mapper.Map <AttachInputDto, Attach>(attachInputDto, attach); long UserId = Convert.ToInt64(OperatorProvider.Provider.GetCurrent().Id); attach.Id = IdWorkerHelper.GenId64(); attach.DeletedMark = false; attach.CreationTime = DateTime.Now; attach.CreatorUserId = UserId; attachRepository.Add(attach); } }