示例#1
0
        public ResultModel Insert()
        {
            try
            {
                PalazzoDBDataContext DataContext = new PalazzoDBDataContext();
                UserResumeDoc        objt        = new UserResumeDoc();

                objt.Id      = Guid.NewGuid();
                objt.UserId  = this.UserID;
                objt.DocText = this.DocText;
                DataContext.UserResumeDocs.InsertOnSubmit(objt);
                DataContext.SubmitChanges();
                return(ResultModel.SuccessResult());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(ResultModel.FailResult());
            }
        }
示例#2
0
        public ResultModel Update()
        {
            //update
            PalazzoDBDataContext DataContext = new PalazzoDBDataContext();

            try
            {
                UserResumeDoc objt = DataContext.UserResumeDocs.Where(x => x.Id.Equals(this.Id)).FirstOrDefault();
                if (objt != null && !objt.Id.Equals(Guid.Empty))
                {
                    //CopyProperties(obj, ref objt);
                    objt.UserId  = this.UserID;
                    objt.DocText = this.DocText;
                    DataContext.SubmitChanges();
                }
                return(ResultModel.SuccessResult());
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                // Provide for exceptions.
                return(ResultModel.FailResult());
            }
        }