/// <summary>Creates a new T.</summary> /// <typeparam name="T">Generic type parameter.</typeparam> /// <param name="entity">The entity.</param> /// <returns>A T.</returns> public T Create <T>(T entity) { var aux = _mapper.Map <EasyPayDb.PaymentMethod>(entity); _easyPayDbContext.PaymentMethods.Add(aux); _easyPayDbContext.SaveChanges(); return(_mapper.Map <T>(aux)); }
/// <summary>Creates a new T.</summary> /// <typeparam name="T">Generic type parameter.</typeparam> /// <param name="entity">The entity.</param> /// <returns>A T.</returns> public T Create <T>(T entity) { var aux = _mapper.Map <User>(entity); _easyPayDbContext.Users.Add(aux); _easyPayDbContext.SaveChanges(); return(_mapper.Map <T>(aux)); }
//■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■ public string Create(string invoiceId, decimal amount) { //Payment Logic using var context = new EasyPayDbContext(); var paypal = new BoletoBancario { Image = "ImgBoleto" }; context.BoletoBancarioPayments.Add(paypal); context.SaveChanges(); return($"PaymentID: {paypal.Id}"); }