public void PostMicrositeTest() { Microsite microsite = null; try { var expectedMicrosite = new Microsite { name = "sample", domains = new List <string> { "sample.com" }, isSecure = false }; microsite = _client.Assets.Microsite.Post(expectedMicrosite); Assert.AreEqual(expectedMicrosite.name, microsite.name); } finally { if (microsite != null && microsite.id > 0) { _client.Assets.Microsite.Delete(microsite.id); } } }
public int AddObjMicrosite(Microsite ObjClass) { try { db.Microsites.Add(ObjClass); return(db.SaveChanges()); } catch (Exception e) { return((int)EnumCore.Result.action_false); } }
public async Task <int> UpdateMicrositeAsync(Microsite ObjClass) { try { db.Entry(ObjClass).State = EntityState.Modified; return(await db.SaveChangesAsync()); } catch (Exception ex) { return(0); } }
public Microsite GetObjMicrositeByID(long id) { try { Microsite ObjMicrosites = db.Microsites.Single(s => s.Id == id); return(ObjMicrosites); } catch { return(null); } }
public async Task <int> AddObjMicrositeAsync(Microsite ObjClass) { try { db.Microsites.Add(ObjClass); return(await db.SaveChangesAsync()); } catch (Exception e) { return((int)EnumCore.Result.action_false); } }
public MyStoreViewModel(Microsite model) { _ModelObj = model; }
public MyStoreViewModel() { _ModelObj = new Microsite(); }
public MicroSiteViewModels(Microsite model) { _ModelObj = model; }
public MicroSiteViewModels() { _ModelObj = new Microsite(); }
/* * Method save comment of user * productId: product id * comments: comment from logged user * fullName: full name of logged user (default is empty string) * email: email of logged user (default is empty string) * cms_db: Controll class from DataMode.DataStore * userId: Id of logged user */ public async Task <int> SaveComments(long idObject, string comments, string fullName, string email, Ctrl cms_db, long userId, int objType, string objTypeName, long parentId) { if (fullName.Length > 250) { fullName = fullName.Substring(0, 249); //To make it fix to column data type length } if (email.Length > 250) { email = email.Substring(0, 249); //To make it fix to column data type length } if (objType == (int)EnumCore.ObjTypeId.san_pham) { Product product = cms_db.GetObjProductById(idObject); Classification classification = cms_db.GetObjClasscifiById((int)Extension.EnumCore.StateType.cho_duyet); if (product != null) { ContentComment comment = new ContentComment(); comment.ParentCommentId = parentId; comment.ContentObjId = idObject; comment.ContentObjName = product.ProductName; comment.Title = null; comment.CommentText = StripHTMLAndScript(comments); //Keep comment clearn without html injection comment.FullName = fullName; comment.EmailAddress = email; comment.CrtdDT = DateTime.Now; comment.AprvdDT = null; comment.AprvdUID = null; comment.AprvdUerName = null; comment.StateId = classification.ClassificationId; comment.StateName = classification.ClassificationNM; comment.CrtdGuestUserId = null; comment.LikeCount = null; comment.LastLikedDT = null; comment.IPAddress = GetIPAddress(); comment.ObjTypeId = objType; comment.ObjTypeName = objTypeName; try { return(await cms_db.AddComment(comment)); } catch (Exception ex) { Core core = new Core(); core.AddToExceptionLog("SaveComments", "ProductController", "Create comment error: " + ex.Message, userId); return(0); } } else { return(0); } } else { Microsite mic = cms_db.GetObjMicrositeByID(idObject); if (mic != null) { ContentComment comment = new ContentComment(); comment.ParentCommentId = parentId; comment.ContentObjId = idObject; comment.ContentObjName = mic.Name; comment.Title = null; comment.CommentText = StripHTMLAndScript(comments); //Keep comment clearn without html injection comment.FullName = fullName; comment.EmailAddress = email; comment.CrtdDT = DateTime.Now; comment.AprvdDT = null; comment.AprvdUID = null; comment.AprvdUerName = null; comment.StateId = (int)EnumCore.StateType.cho_phep; comment.StateName = "Cho phép"; comment.CrtdGuestUserId = null; comment.LikeCount = null; comment.LastLikedDT = null; comment.IPAddress = GetIPAddress(); comment.ObjTypeId = objType; comment.ObjTypeName = objTypeName; try { return(await cms_db.AddComment(comment)); } catch (Exception ex) { Core core = new Core(); core.AddToExceptionLog("SaveComments", "ProductController", "Create comment error: " + ex.Message, userId); return(0); } } return(0); } }