Exemple #1
0
        public static Help ToDataModel(this Contracts.Help.CreateHelpEntry create)
        {
            var dataModel = new Help
            {
                Language    = create.Language,
                Slug        = create.Slug,
                Title       = create.Title,
                Description = create.Description,
                CreatedOn   = DateTime.Now,
                UpdatedOn   = DateTime.Now,
            };

            return(dataModel);
        }
Exemple #2
0
        public Contracts.Help.HelpEntry Create(Contracts.Help.CreateHelpEntry create)
        {
            using (var db = new RAAPMasterEntities())
            {
                if (db.Helps.Any(a => a.Slug == create.Slug && a.Language == create.Language))
                {
                    throw new RAAPConflictException("Slug & language combination is already in use!");
                }

                var help = create.ToDataModel();
                db.Helps.Add(help);
                db.SaveChanges();

                return(db.Helps.FirstOrDefault(u => u.HelpId == help.HelpId).ToContract());
            }
        }
Exemple #3
0
        public IHttpActionResult Post([FromBody] Contracts.Help.CreateHelpEntry create)
        {
            var result = HelpService.Create(create);

            return(Ok(result));
        }