public ActionResult Detail(int id) { Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo(); Maticsoft.Model.CMS.Photo model = new Maticsoft.Model.CMS.Photo(); model = photo.GetModel(id); if (model == null) { return new EmptyResult(); } List<Maticsoft.Model.CMS.Photo> list = photo.GetListAroundPhotoId(10, id, model.ClassID); return base.View(list); }
public void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(this.txtPhotoName.Text)) { MessageBox.ShowFailTip(this, CMSPhoto.ErrorImageNameNull); } else if (string.IsNullOrWhiteSpace(this.txtDescription.Text)) { MessageBox.ShowFailTip(this, CMSPhoto.ErrorIntroductionNull); } else if (!PageValidate.IsNumber(this.txtSequence.Text)) { MessageBox.ShowFailTip(this, CMSPhoto.ErrorOrderFormat); } else if (string.IsNullOrWhiteSpace(this.txtTags.Text)) { MessageBox.ShowFailTip(this, CMSPhoto.ErrorLabel); } else { string text = this.txtPhotoName.Text; string str2 = this.txtDescription.Text; int num = int.Parse(this.ddlAlbum.SelectedValue); int num2 = int.Parse(this.ddlState.SelectedValue); int num3 = int.Parse(this.lblPVCount.Text); int num4 = 0; if (!string.IsNullOrWhiteSpace(this.ddlPhotoClass.SelectedValue)) { num4 = int.Parse(this.ddlPhotoClass.SelectedValue); } int num5 = int.Parse(this.txtSequence.Text); bool flag = this.chkIsRecomend.Checked; string str3 = this.txtTags.Text; Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo(); Maticsoft.Model.CMS.Photo model = photo.GetModel(this.PhotoID); if (model != null) { model.PhotoName = text; model.Description = str2; model.AlbumID = num; model.State = num2; model.PVCount = num3; model.ClassID = num4; model.Sequence = new int?(num5); model.IsRecomend = new bool?(flag); model.Tags = str3; if (photo.Update(model)) { MessageBox.ResponseScript(this, "parent.location.href='list.aspx?AlbumID=" + num + "'"); } } } }
public ActionResult AjaxLikePhoto(int PhotoId) { Maticsoft.BLL.CMS.Photo photo = new Maticsoft.BLL.CMS.Photo(); Maticsoft.Model.CMS.Photo model = new Maticsoft.Model.CMS.Photo(); if (photo.Exists(PhotoId)) { model = photo.GetModel(PhotoId); model.FavouriteCount++; if (photo.Update(model)) { return base.Content("True"); } } return base.Content("False"); }