public HttpResponseMessage SavePOSpecificTandC(TEPOSpecificTCDetail specTC)
        {
            try
            {
                string temp = string.Empty;
                temp                           = specTC.Description.Trim();
                specTC.IsDeleted               = false;
                specTC.LastModifiedOn          = DateTime.Now;
                specTC.CreatedOn               = DateTime.Now;
                specTC.Description             = temp.Replace("<br/>", "").Replace("<br>", "");
                specTC.SpecificTCTitleMasterId = specTC.SpecificTCTitleMasterId;
                db.TEPOSpecificTCDetails.Add(specTC);
                db.SaveChanges();

                sinfo.errorcode    = 0;
                sinfo.errormessage = "Successfully Saved";
                return(new HttpResponseMessage()
                {
                    Content = new JsonContent(new { info = sinfo })
                });
            }
            catch (Exception ex)
            {
                ExceptionObj.RecordUnHandledException(ex);
                sinfo.errorcode    = 1;
                sinfo.errormessage = "Fail To Save";
                return(new HttpResponseMessage()
                {
                    Content = new JsonContent(new { info = sinfo })
                });
            }
        }
        public HttpResponseMessage UpdatePOSpecificTandC(TEPOSpecificTCDetail specTC)
        {
            try
            {
                String temp = specTC.Description;
                specTC.Description = temp.Replace("<br/>", "").Replace("<br>", "");
                TEPOSpecificTCDetail specTCExist = new TEPOSpecificTCDetail();
                specTCExist = db.TEPOSpecificTCDetails.Where(a => a.IsDeleted == false && a.SpecificTCId == specTC.SpecificTCId).FirstOrDefault();
                if (specTCExist != null)
                {
                    specTCExist.Description = specTC.Description;

                    specTCExist.LastModifiedOn             = DateTime.Now;
                    specTCExist.SpecificTCSubTitleMasterId = specTC.SpecificTCSubTitleMasterId;
                    specTCExist.SpecificTCTitleMasterId    = specTC.SpecificTCTitleMasterId;
                    db.Entry(specTCExist).CurrentValues.SetValues(specTCExist);
                    db.SaveChanges();

                    sinfo.errorcode    = 0;
                    sinfo.errormessage = "Successfully Updated";
                    return(new HttpResponseMessage()
                    {
                        Content = new JsonContent(new { info = sinfo })
                    });
                }
                else
                {
                    sinfo.errorcode    = 0;
                    sinfo.errormessage = "Unable to Update";
                    return(new HttpResponseMessage()
                    {
                        Content = new JsonContent(new { info = sinfo })
                    });
                }
            }
            catch (Exception ex)
            {
                ExceptionObj.RecordUnHandledException(ex);
                sinfo.errorcode    = 1;
                sinfo.errormessage = "Fail To Update";
                return(new HttpResponseMessage()
                {
                    Content = new JsonContent(new { info = sinfo })
                });
            }
        }
        public HttpResponseMessage DeletePOSpecificTandC(TEPOSpecificTCTitleMaster specTitleTC)
        {
            try
            {
                var specTCListIds = (from tcDetail in db.TEPOSpecificTCDetails
                                     join subtitle in db.TEPOSpecificTCSubTitleMasters on tcDetail.SpecificTCSubTitleMasterId equals subtitle.SpecificTCSubTitleMasterId
                                     where subtitle.SpecificTCTitleMasterId == specTitleTC.SpecificTCTitleMasterId && subtitle.IsDeleted == false
                                     select new { tcDetail.SpecificTCId }).ToList();

                foreach (var specData in specTCListIds)
                {
                    TEPOSpecificTCDetail specTCExist = new TEPOSpecificTCDetail();
                    specTCExist = db.TEPOSpecificTCDetails.Where(a => a.IsDeleted == false && a.SpecificTCId == specData.SpecificTCId).FirstOrDefault();
                    if (specTCExist != null)
                    {
                        specTCExist.LastModifiedOn = DateTime.Now;
                        specTCExist.IsDeleted      = true;
                        db.Entry(specTCExist).CurrentValues.SetValues(specTCExist);
                        db.SaveChanges();
                    }
                    else
                    {
                        //sinfo.errorcode = 0;
                        //sinfo.errormessage = "Unable to Delete";
                        //return new HttpResponseMessage() { Content = new JsonContent(new { info = sinfo }) };
                    }
                }
            }
            catch (Exception ex)
            {
                ExceptionObj.RecordUnHandledException(ex);
                sinfo.errorcode    = 1;
                sinfo.errormessage = "Fail To Delete";
                return(new HttpResponseMessage()
                {
                    Content = new JsonContent(new { info = sinfo })
                });
            }

            sinfo.errorcode    = 0;
            sinfo.errormessage = "Successfully Deleted";
            return(new HttpResponseMessage()
            {
                Content = new JsonContent(new { info = sinfo })
            });
        }
        public HttpResponseMessage DeletePOSpecificTandC_SingleDelete(TEPOSpecificTCDetail specTC)
        {
            try
            {
                TEPOSpecificTCDetail specTCExist = new TEPOSpecificTCDetail();
                specTCExist = db.TEPOSpecificTCDetails.Where(a => a.IsDeleted == false && a.SpecificTCId == specTC.SpecificTCId).FirstOrDefault();
                //  specTCExist = db.TEPOSpecificTCDetails.Where(a => a.IsDeleted == false && a.SpecificTCId == specTC.SpecificTCSubTitleMasterId).FirstOrDefault();
                if (specTCExist != null)
                {
                    specTCExist.LastModifiedOn = DateTime.Now;
                    specTCExist.IsDeleted      = true;
                    db.Entry(specTCExist).CurrentValues.SetValues(specTCExist);
                    db.SaveChanges();

                    sinfo.errorcode    = 0;
                    sinfo.errormessage = "Successfully Deleted";
                    return(new HttpResponseMessage()
                    {
                        Content = new JsonContent(new { info = sinfo })
                    });
                }
                else
                {
                    sinfo.errorcode    = 0;
                    sinfo.errormessage = "Unable to Delete";
                    return(new HttpResponseMessage()
                    {
                        Content = new JsonContent(new { info = sinfo })
                    });
                }
            }
            catch (Exception ex)
            {
                ExceptionObj.RecordUnHandledException(ex);
                sinfo.errorcode    = 1;
                sinfo.errormessage = "Fail To Delete";
                return(new HttpResponseMessage()
                {
                    Content = new JsonContent(new { info = sinfo })
                });
            }
        }