Exemple #1
0
        public ActionResult SaveChanges(FormCollection form)
        {
            Guid albumId = Guid.Parse(form["hdAlbumId"].ToString());

            List <Models.PhotoViewModel> photos = this.GetPhotosByAlbumId(albumId);

            if (photos != null && photos.Count > 0)
            {
                foreach (var item in photos)
                {
                    Update update = UnigateObject.Update(Manager.Settings.Current.PhotoListTableName);

                    if (Manager.Settings.Current.PhotoListTableTitleField != null && !string.IsNullOrEmpty(Manager.Settings.Current.PhotoListTableTitleField.Name))
                    {
                        update = update.Column(Manager.Settings.Current.PhotoListTableTitleField.Name, form["Txt_" + item.Id.ToString()].ToString());
                    }

                    if (Manager.Settings.Current.PhotoListTableOrderNoField != null && !string.IsNullOrEmpty(Manager.Settings.Current.PhotoListTableOrderNoField.Name))
                    {
                        update = update.Column(Manager.Settings.Current.PhotoListTableOrderNoField.Name, Convert.ToInt32(form["Hd_" + item.Id.ToString()].ToString()));
                    }

                    update.Where("Id", item.Id).Execute();
                }
            }

            return(Redirect("/unigate/" + Unigate.PhotoGallery.AdminPlugin.Manager.PluginProperties.PluginName + "/?albumId=" + albumId.ToString()));
        }
Exemple #2
0
        public static Field SaveField(Field field)
        {
            MDataSourceResult result;
            var _field = UnigateObject.Query("Editable")
                         .WhereEqualTo("FieldKey", field.FieldKey)
                         .WhereEqualTo("SiteLanguageId", field.SiteLanguageId)
                         .WhereEqualTo("PageId", field.PageId)
                         .ToList <Field>()
                         .FirstOrDefault();

            if (_field == null)
            {
                result = UnigateObject.Insert <Field>("Editable", field)
                         .Column("SiteLanguageId", field.SiteLanguageId)
                         .Execute();
                _field = field;
            }
            else
            {
                result = UnigateObject.Update("Editable")
                         .Column("Value", field.Value ?? "&nbsp;")
                         .WhereEqualTo("ContentId", _field.ContentId)
                         .Execute();
                _field.Value = field.Value;
            }
            if (result.ResultCode != ResultCode.Successfull)
            {
                _field.Errors = result.ResultMessage;
            }
            return(_field);
        }
Exemple #3
0
 public MDataSourceResult UpdateUserPassword(UserModel model)
 {
     return(UnigateObject.Update("ayMembers")
            .Column("Password", model.Password)
            .Column("Title", model.Title)
            .Where("ContentId", model.ContentId).Execute());
 }
        public ActionResult Save(SiteRedirectModel model)
        {
            model.Title = model.LocalAddress;

            if (model.ContentId == Guid.Empty)
            {
                Insert insertRedirect = UnigateObject.Insert("SiteRedirect", model);
                var    result         = insertRedirect.Execute();
            }
            else
            {
                var result = UnigateObject.Update("SiteRedirect")
                             .Column("PageId", model.PageId)
                             .Column("Title", model.Title)
                             .Column("RouteAddress", model.RouteAddress)
                             .Column("LocalAddress", model.LocalAddress)
                             .Column("IsTemporary", model.IsTemporary)
                             .Column("TransferQuerystring", model.TransferQuerystring)
                             .WhereEqualTo("ContentId", model.ContentId).Execute();

                ViewBag.Result = result.ResultMessage;
            }

            UnigateObject.Update("SiteMapLastUpdate")
            .Column("SiteRedirectLastUpdateDate", DateTime.Now.ToString()).Execute();

            return(RedirectToAction("Index"));
        }
        public ActionResult Save(EditableImage image)
        {
            if (!EditableImageAuthorization.Authorization())
            {
                throw new Exception("Bu işlemi yapmak için yetkiniz yok.");
            }

            EditableImage existsImage = UnigateObject.Query("EditableImage")
                                        .WhereEqualTo("Code", image.Code)
                                        .FirstOrDefault <EditableImage>();

            Guid imageGuid = Guid.Empty;

            if (existsImage != null)
            {
                var update = UnigateObject.Update("EditableImage")
                             .Column("Code", image.Code)
                             .Column("ImageFile", image.ImageFile)
                             .WhereEqualTo("ContentId", existsImage.ContentId)
                             .Execute();

                if (update.ResultCode == ResultCode.Successfull)
                {
                    imageGuid = existsImage.ContentId;
                }
            }
            else
            {
                var insert = UnigateObject.Insert("EditableImage", image).Execute();
                if (insert.ResultCode == ResultCode.Successfull)
                {
                    imageGuid = Guid.Parse(insert.OutParameters.Get("ContentId"));
                }
            }

            return(new JsonResult()
            {
                Data = imageGuid,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            });
        }