public static object InsertTestimonials(TestimonialsVM item) { if (Utils.LoggedUser != null) { item.PortalUserID = (int)Utils.LoggedUser.PortalUserId; } else { ; return(Utils.ServiceResponse("F034", new ModelResponse(101), null)); } return(MgrTestimonial.Insert(item)); }
public int Insert(TestimonialsVM item) { Testimonial it = new Testimonial { PostDate = DateTime.Now, PortalUserID = item.PortalUserID, IsApproved = 1, SiteRating = item.SiteRating }; it.TestimonialsDetails.Add(new TestimonialsDetail { Comments = item.Comments, LanguageID = 1 }); Context.Testimonials.Add(it); return(Context.SaveChanges()); }
public ActionResult <ResultVM <bool> > Create(TestimonialsVM testimonialsVM) { ResultVM <bool> resultVM = new ResultVM <bool>(); try { TestimonialsModel testimonialsModel = new TestimonialsModel(); mapper.Map(testimonialsVM, testimonialsModel); var result = testimonialsBusiness.CreateTestimonials(testimonialsModel); mapper.Map(result, resultVM); return(resultVM); } catch (Exception ex) { resultVM.Message = ex.Message; resultVM.StatusCode = Convert.ToInt32(Enums.StatusCode.BadRequest); return(StatusCode(StatusCodes.Status400BadRequest, new { Result = resultVM })); } }
public ActionResult <ResultVM <bool> > Update(TestimonialsVM testimonialsVM) { ResultVM <bool> resultVM = new ResultVM <bool>(); try { TestimonialsModel TestimonialsModel = new TestimonialsModel(); mapper.Map(testimonialsVM, TestimonialsModel); var result = testimonialsBusiness.UpdateTestimonials(TestimonialsModel); mapper.Map(result, resultVM); } catch (Exception ex) { Common.LogMessage(ex.Message); resultVM.Message = ex.Message; resultVM.StatusCode = Convert.ToInt32(Enums.StatusCode.BadRequest); return(StatusCode(StatusCodes.Status400BadRequest, new { Result = resultVM, Codes = new string[] { "ServerError" } })); } return(resultVM); }
public int Insert(TestimonialsVM item) { return(_repo.Insert(item)); }