Esempio n. 1
0
        public ActionResult AlterPicEdit(string id, string brandNo)
        {
            SwfsFlagShipFlash entity;

            if (string.IsNullOrEmpty(id))
            {
                entity              = new SwfsFlagShipFlash();
                entity.DataCreate   = DateTime.Now;
                entity.PictureIndex = 0;
                entity.State        = 1;
                entity.DataState    = 1;
            }
            else
            {
                entity = _flash.GetEntityByIdAndBrandNo(Convert.ToInt32(id), brandNo);
            }
            return(View(entity));
        }
Esempio n. 2
0
        public JsonResult AlterPicEdit(FormCollection form)
        {
            ResultBase_form   result = new ResultBase_form();
            SwfsFlagShipFlash entity = new SwfsFlagShipFlash();

            TryUpdateModel <SwfsFlagShipFlash>(entity, form);
            HttpPostedFileBase file = Request.Files["picFile"];

            rsPic.Clear();
            if (file != null && file.ContentLength > 0)
            {
                rsPic = _SwfsFlagShipModuleLinkService.SaveImg(Request.Files["picFile"], "width:960 ,Height:470,Length:500");
                //rsPic = _com.PostImg(file, "width:0 ,Height:0,Length:100");
                if (rsPic.Keys.Contains("error"))
                {
                    result.status = 0;
                    result.msg    = rsPic["error"];
                    return(Json(result, JsonRequestBehavior.AllowGet));
                }
                else
                {
                    entity.PictureNo = rsPic["success"];
                }
            }
            else
            {
                if (!string.IsNullOrEmpty(Request.Form["LogoNo"]))
                {
                    entity.PictureNo = Request.Form["LogoNo"];
                }
            }
            if (entity.FlashId == 0)
            {
                result.status = _flash.Insert(entity);
            }
            else
            {
                result.status = _flash.Update(entity) ? 1 : 0;
            }
            result.msg     = result.status == 0 ? "操作失败" : "操作成功";
            result.content = entity;
            return(Json(result, JsonRequestBehavior.AllowGet));
        }
 public bool Update(SwfsFlagShipFlash entity)
 {
     return(DapperUtil.Update <SwfsFlagShipFlash>(entity));
 }
 public int Insert(SwfsFlagShipFlash entity)
 {
     return(DapperUtil.Insert <SwfsFlagShipFlash>(entity, true));
 }