public void AddQoute(AddOrUpdateQuoteForm form) { var quote = new Quote(form.Author, form.Text); var query = QueryToQuote.InsertQoute; query = query.Replace("@author", quote.Author); query = query.Replace("@text", quote.Text); query = query.Replace("@createdat", quote.CreatedAt.ToString()); if (form.CategoryId != Guid.Empty) { query = query.Replace("@categoryid", form.CategoryId.ToString()); } _db.Context.Execute(query); }
public void UpdateQuote(AddOrUpdateQuoteForm form) { var quote = new Quote(form.Author, form.Text); var query = QueryToQuote.UpdateQouteById; query = query.Replace("@author", quote.Author); query = query.Replace("@text", quote.Text); if (form.CategoryId != Guid.Empty) { query = query.Replace("@categoryid", form.CategoryId.ToString()); } query = query.Replace("@quoteId", quote.Id.ToString()); _db.Context.Execute(query); }
public void UpdateQuote(AddOrUpdateQuoteForm form) => _quoteRepo.UpdateQuote(form);
public void AddQuote(AddOrUpdateQuoteForm form) => _quoteRepo.AddQoute(form);