示例#1
0
 public bool GetRegister([FromUri] RegisterMaster a)
 {
     try
     {
         bool b = checkForMail(a.mail);
         if (b == true)
         {
             AuthorMaster au = new AuthorMaster()
             {
                 mail  = a.mail,
                 uname = a.uname,
                 fname = a.fname,
                 pass  = a.pass,
                 lname = a.lname
             };
             dc.AuthorMasters.InsertOnSubmit(au);
             dc.SubmitChanges();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 /// <summary>
 /// create by Vishal Verma on 12/05/2016
 /// Gets all Sub ProductType by ProductType Id WISE
 /// </summary>
 /// <param name="showDeactivated">A value indicating whether to show hidden records</param>
 /// <returns>Author suggesation</returns>
 public virtual IList <AuthorMaster> GetAuthorSuggesationList(AuthorMaster AuthorMaster)
 {
     return(_AuthorRepository.Table.Where(a => a.Deactivate == "N" &&
                                          a.Type == AuthorMaster.Type &&
                                          ((a.FirstName.Contains(AuthorMaster.FirstName) ||
                                            a.LastName.Contains(AuthorMaster.FirstName) ||
                                            (a.FirstName + " " + a.LastName).Contains(AuthorMaster.FirstName)))).OrderBy(c => c.LastName).ToList());
 }
示例#3
0
        public AuthorMaster GetAuthor(string mail)
        {
            //Fetch Author Info
            AuthorMaster author = (from x in dc.GetTable <AuthorMaster>()
                                   where x.mail == mail
                                   select x).SingleOrDefault();

            return(author);
        }
示例#4
0
 public ActionResult Edit([Bind(Include = "AuthorID,AuthorName,Dob,EmailAddress")] AuthorMaster authMaster)
 {
     if (ModelState.IsValid)
     {
         _IAuthorRepository.UpdateAuthor(authMaster);
         _IAuthorRepository.Save();
         return(RedirectToAction("Index"));
     }
     return(View(authMaster));
 }
示例#5
0
        //

        ////Added by Saddam on 09/05/2016
        //[HttpGet]
        //public IHttpActionResult getAuthorList()
        //{
        //    return Json(_CommonListService.GetAllAuthor().ToList());
        //}


        public IHttpActionResult AuthorSuggesationList(AuthorMaster AuthorMaster)
        {
            IList <AuthorMaster> _AuthorList = _CommonListService.GetAuthorSuggesationList(AuthorMaster).ToList();
            var AuthorSuggesation            = _AuthorList.Select(Au => new
            {
                AuthorId      = Au.Id,
                AuthorName    = Au.FirstName + " " + Au.LastName,
                AuthorCode    = Au.AuthorCode,
                AuthorSAPCode = Au.AuthorSAPCode,
            });

            return(Json(SerializeObj.SerializeObject(new { AuthorSuggesation })));
        }
示例#6
0
        public int InsertAuthor(AuthorMaster Author)
        {
            Author.Deactivate = "N";
            //  Author.EnteredBy = 10;
            Author.EntryDate      = DateTime.Now;
            Author.ModifiedBy     = null;
            Author.ModifiedDate   = null;
            Author.DeactivateBy   = null;
            Author.DeactivateDate = null;

            _AuthorRepository.Insert(Author);
            return(Author.Id);
        }
示例#7
0
        // GET: AuthMasters/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AuthorMaster authMaster = _IAuthorRepository.GetAuthorById(id);

            if (authMaster == null)
            {
                return(HttpNotFound());
            }
            return(View(authMaster));
        }
示例#8
0
        // public virtual IList<AuthorMaster> GetAllAuthor()
        // {
        // var Author = _AuthorRepository.Table.Where(a => a.LastName != null && a.Deactivate == "N").OrderBy(c => c.LastName).ToList();
        // return Author;


        //}


        public string DuplicityCheck(AuthorMaster Author)
        {
            var dupes = _AuthorRepository.Table.Where(x => x.Email == Author.Email &&
                                                      x.Deactivate == "N" &&
                                                      (Author.Id != 0 ? x.Id : 0) != (Author.Id != 0 ? Author.Id : 1)).FirstOrDefault();

            if (dupes != null)
            {
                return("N");
            }
            else
            {
                return("Y");
            }
        }
示例#9
0
        public ArticleReturn GetArticle(string url)
        {
            ArticleMaster articles = (from x in dc.GetTable <ArticleMaster>()
                                      where x.url == url
                                      select x).SingleOrDefault();


            AuthorMaster authorIs = (from auth in dc.GetTable <AuthorMaster>()
                                     where auth.Id == articles.author_id
                                     select auth).SingleOrDefault();

            ArticleReturn ar = new ArticleReturn()
            {
                Id           = articles.Id, author_id = articles.author_id,
                author_fname = authorIs.fname, author_lname = authorIs.lname,
                title        = articles.title, uploaded_date = articles.uploaded_date,
                url          = articles.url, author_uname = authorIs.uname,
                text         = articles.text
            };

            return(ar);
        }
示例#10
0
        public IEnumerable <ArticleReturn> getAllArticlesBy(int id)
        {
            var articles = from x in dc.GetTable <ArticleMaster>()
                           where x.author_id == id
                           select x;

            if (articles == null)
            {
                return(null);
            }
            List <ArticleReturn> lar = new List <ArticleReturn>();

            foreach (var x in articles)
            {
                AuthorMaster authorIs = (from auth in dc.GetTable <AuthorMaster>()
                                         where auth.Id == x.author_id
                                         select auth).SingleOrDefault();
                lar.Add(new ArticleReturn()
                {
                    Id = x.Id, author_id = x.author_id, title = x.title, uploaded_date = x.uploaded_date, url = x.url
                });
            }
            return(lar);
        }
示例#11
0
 public void UpdateAuthor(AuthorMaster Auth)
 {
     _Context.Entry(Auth).State = System.Data.Entity.EntityState.Modified;
 }
示例#12
0
        public void DeleteAuthor(int?id)
        {
            AuthorMaster Auth = _Context.AuthorMasters.Find(id);

            _Context.AuthorMasters.Remove(Auth);
        }
示例#13
0
 public void InsertAuthor(AuthorMaster Auth)
 {
     _Context.AuthorMasters.Add(Auth);
 }
示例#14
0
 public AuthorMaster  GetAuthorById(AuthorMaster Author)
 {
     return(_AuthorRepository.Table.Where(i => i.Id == Author.Id && i.Deactivate == "N").FirstOrDefault());
 }
示例#15
0
 public virtual IList <AuthorMaster> GetAuthorist(AuthorMaster Author)
 {
     return(_AuthorRepository.Table.Where(a => a.Deactivate == "N" && a.Id == Author.Id).OrderBy(c => c.LastName).ToList());
 }
示例#16
0
 public void DeleteAuthor(AuthorMaster Author)
 {
     _AuthorRepository.Delete(Author);
 }
示例#17
0
 public void UpdateAuthor(AuthorMaster Author)
 {
     _AuthorRepository.Update(Author);
 }