コード例 #1
0
        public string ModifyData(string prefix, string nameCn, string nameEn, string nameJp, string birth, string chest,
                                 string tags, string pictureLink)
        {
            var db      = new CoreDriverContext();
            var newData = new CoreActress()
            {
                NameCn      = nameCn,
                NameEn      = nameEn,
                NameJp      = nameJp,
                Birth       = birth,
                Chest       = chest,
                Tags        = tags,
                PictureLink = pictureLink
            };

            try
            {
                db.CoreActress.Update(newData);
                db.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return("501");
                //throw;
            }
            finally
            {
                db.Dispose();
            }

            return("200");
        }
コード例 #2
0
        public string AddNewData(CoreVideo newData)
        {
            var db   = new CoreDriverContext();
            var data = db.CoreVideo.Where(v => v.WholeSerial == newData.WholeSerial);

            if (data.Any())
            {
                return("502");
            }


            try
            {
                db.CoreVideo.Add(newData);

                //Add new actress
                var actress = db.CoreActress.Where(v => v.NameCn == newData.ActressName);
                if (!actress.Any())
                {
                    var newActress = new CoreActress()
                    {
                        NameCn = newData.ActressName,
                    };
                    db.CoreActress.Add(newActress);
                }

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return("501");
                //throw;
            }
            finally
            {
                db.Dispose();
            }

            return("200");
        }
コード例 #3
0
        public string AddNewData(string prefix, string serial, string wholeSerial, string nameCn, string nameEn, string nameJp,
                                 string tag, string magnetLink, string torrentLink, string pictureLink, string companyName, string IsStored)
        {
            if (string.IsNullOrEmpty(wholeSerial))
            {
                wholeSerial = prefix + "-" + serial;
            }
            else
            {
                if (wholeSerial.Contains("-"))
                {
                    var ws = wholeSerial.Split('-');
                    if (ws.Length == 2)
                    {
                        prefix = ws[0];
                        serial = ws[1];
                    }
                }
            }

            var db   = new CoreDriverContext();
            var data = db.CoreVideo.Where(v => v.WholeSerial == wholeSerial);

            if (data.Any())
            {
                return("502");
            }

            var newData = new CoreVideo()
            {
                Prefix      = prefix,
                Serial      = serial,
                WholeSerial = wholeSerial,
                Tags        = tag,
                MagnetLink  = magnetLink,
                TorrentLink = torrentLink,
                PictureLink = pictureLink,
                CompanyName = companyName,
                ActressName = nameCn
            };

            try
            {
                db.CoreVideo.Add(newData);

                //Add new actress
                var actress = db.CoreActress.Where(v => v.NameCn == nameCn);
                if (!actress.Any())
                {
                    var newActress = new CoreActress()
                    {
                        NameCn      = nameCn,
                        NameEn      = nameEn,
                        NameJp      = nameJp,
                        PictureLink = pictureLink
                    };
                    db.CoreActress.Add(newActress);
                }

                db.SaveChanges();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                return("501");
                //throw;
            }
            finally
            {
                db.Dispose();
            }

            return("200");
        }