public Transaction?MapToModelOrNull(TransactionEntity?entity) { if (entity is null) { return(null); } var model = Transaction.Create(entity.Id, entity.Date, entity.Amount, entity.Description, entity.AccountId, entity.CategoryId, entity.UserId); if (entity.CashflowId is not null) { model = model.ApplyCashflow(entity.CashflowId.GetValueOrDefault(), entity.CashflowDate.GetValueOrDefault()); } return(model.SetTags(_tagsMapper.Map(entity.Tags))); }
public ActionResult Details(string name) { TagViewModel item = TagsMapper.Map(_tagsService.Get(name)); if (User.Identity.IsAuthenticated) { ViewBag.CurrentUser = UsersMapper.Map(_currentUserService.GetDTO); } return(View(item)); }
/// <summary> /// Loads tag by name and returns tag DTO. /// </summary> public TagDTO Get(string name) { Tag tag = _unitOfWork.Tags.Find(t => t.Name == name).FirstOrDefault(); if (tag != null) { return(TagsMapper.Map(tag)); } return(null); }
public Cashflow?MapToModelOrNull(CashflowEntity?entity) { if (entity is null) { return(null); } var model = new Cashflow() { Id = entity.Id, AccountId = entity.AccountId, Amount = entity.Amount, CategoryId = entity.CategoryId, Description = entity.Description, EffectiveDate = entity.EffectiveDate, Frequency = entity.Frequency, Inactive = entity.Inactive, IntervalType = entity.IntervalType, Recurrence = entity.Recurrence, UserId = entity.UserId }; return(model.SetTags(_tagsMapper.Map(entity.Tags))); }
public TagViewModel Get(string name) { return(TagsMapper.Map(_tagsService.Get(name))); }