public bool AddAlms(AlmsgivingEntity alms) { try { string filepath = @"D:\TPO3_Photos\" + Guid.NewGuid() + ".jpg"; File.WriteAllBytes(filepath, Convert.FromBase64String(alms.Photo)); Almsgiving alm = _mapper.AlmEntityToAlms(alms, DateTime.Today, filepath); _almsgivingRepository.AddAlmsgiving(alm); return(true); } catch (Exception) { return(false); } }
public AlmsgivingEntity AlmsToAlmEntity(Almsgiving alms, Bearer bearer, string photo) { return(new AlmsgivingEntity() { Id = alms.Id, Description = alms.Description, BearerId = bearer.Id, Date = alms.Date, Name = alms.Name, Nickname = bearer.Nickname, Phone = bearer.Phone, Photo = photo, Type = alms.Type }); }