public AjaxResult CarouselPhotoListSave(CarouselPhoto model)
        {
            CarouselPhoto ent = db.CarouselPhoto.FirstOrDefault(m => m.Id == model.Id);

            if (ent == null)
            {
                ent            = model;
                ent.CreateTime = DateTime.Now;
                ent.IsActive   = 1;
                db.CarouselPhoto.Add(ent);
            }
            else
            {
                ent.CreateTime  = DateTime.Now;
                ent.Author      = model.Author;
                ent.Content     = model.Content;
                ent.Time        = model.Time;
                ent.ImgUrl      = model.ImgUrl;
                ent.Remark      = model.Remark;
                ent.Description = model.Description;
                ent.Title       = model.Title;
                ent.Headline    = model.Headline;
            }
            int r = db.SaveChanges();

            if (r <= 0)
            {
                return(new AjaxResult("保存失败"));
            }
            return(new AjaxResult("保存成功", 0));
        }
Example #2
0
        public ActionResult CarouselPhotoEdit(int?id)
        {
            var ent = _CarouselPhotoManager.GetCarouselPhotoById(id);

            if (ent == null)
            {
                ent = new CarouselPhoto();
            }
            return(View(ent));
        }
Example #3
0
        public JsonResult CarouselPhotoListSave(CarouselPhoto model)
        {
            var r = _CarouselPhotoManager.CarouselPhotoListSave(model);

            return(Json(r));
        }