public void CreateQuote(QuoteSM quote) { try { quote.RatingNum = 0; quoteData.CreateQuote(Map(quote)); logs.LogError("Event ", "User was able to create new item ", "Class:QuoteLogic, Method:CreateQuote"); } catch (Exception P) { logs.LogError("Error ", "User was unable to create a new item ", "Class:UserLogic, Method:CreateQuote"); } }
private QuoteSM Map(QuoteDM quote) { QuoteSM phrase = new QuoteSM(); phrase.QuoteId = Convert.ToInt32(quote.QuoteId); phrase.Phrase = quote.Phrase; phrase.Author = quote.Author; phrase.CategoryNum = Convert.ToInt32(quote.Category); phrase.RatingNum = Convert.ToInt32(quote.Rating); phrase.NumRatings = Convert.ToInt32(quote.NumRatings); phrase.RatingScore = Convert.ToInt32(quote.RatingScore); return(phrase); }
private QuoteDM Map(QuoteSM quote) { QuoteDM phrase = new QuoteDM(); phrase.QuoteId = quote.QuoteId.ToString(); phrase.Phrase = quote.Phrase; phrase.Author = quote.Author; phrase.Category = quote.CategoryNum.ToString(); phrase.Rating = quote.RatingNum.ToString(); phrase.NumRatings = quote.NumRatings.ToString(); phrase.RatingScore = quote.RatingScore.ToString(); return(phrase); }
public void EditQuoteById(QuoteSM quote) { try { if (quote.NumRatings > 0) { quote.RatingNum = (quote.RatingScore / quote.NumRatings); } quoteData.EditQuoteById(Map(quote)); logs.LogError("Event ", "User was able to update Quote", "Class:QuoteLogic, Method:UpdateQuoteById"); } catch (Exception e) { logs.LogError("Error ", "User was unable to update Quote", "Class:QuoteLogic, Method:UpdateQuoteById"); } }