Esempio n. 1
0
        public async Task <IActionResult> SaveHeader([FromBody] JSHeader header)
        {
            string token = this.GetToken();

            if (!db.IsAuthenticated(token))
            {
                return(Unauthorized());
            }
            if (!this.HasRight("adminheaders"))
            {
                return(Unauthorized());
            }
            db.SaveHeader(header);
            this.SaveUserAction(this.GetUserAction("Запис на заглавна част", JObject.FromObject(header).ToString()));

            return(Ok());
        }
Esempio n. 2
0
        public void SaveHeader(JSHeader header)
        {
            Header h;

            if (header.HeaderId == 0)
            {
                h = ModelMapper.Instance.Mapper.Map <Header>(header);
                db.Header.Add(h);
            }
            else
            {
                h              = db.Header.First(x => x.HeaderId == header.HeaderId);
                h.Content      = header.Content;
                h.Title        = header.Title;
                h.PortalPartId = header.PortalPartId;
            }
            db.SaveChanges();
        }