public IActionResult GetInfo([FromBody] SearchPictureInfoInputModel model)
 {
     if (ModelState.IsValid)
     {
         var res = repo.SearchPictureInfo(model);
         if (res != null)
         {
             return(Ok(res));
         }
     }
     return(BadRequest());
 }
        public SearchPictureInfoOutputModel SearchPictureInfo(SearchPictureInfoInputModel input)
        {
            var res = repo.SearchPictureInfo(input);

            if (res != null)
            {
                res.AdditionalImages = repo.GetAllAdditionalPictures(input);
                res.Prc_ID           = input.Prc_ID;
                int difference = (DateTime.Now - Convert.ToDateTime(res.gdate)).Days;
                res.isActive = difference > 30 ? false : true;
                return(res);
            }
            return(null);
        }
Beispiel #3
0
        public SearchPictureInfoOutputModel SearchPictureInfo(SearchPictureInfoInputModel input)
        {
            var res = new SearchPictureInfoOutputModel();

            using (IDbConnection db = new SqlConnection(Global.Connection))
            {
                res = db.Query <SearchPictureInfoOutputModel>("sp_SearchPictureInfo",
                                                              new {
                    Prc_ID  = input.Prc_ID,
                    Cust_ID = input.Cust_ID,
                    AppCode = input.AppCode
                },
                                                              commandType: CommandType.StoredProcedure).FirstOrDefault();
            }
            return(res);
        }
Beispiel #4
0
        private List <Picture> GetAllAdditionalPictures(SearchPictureInfoInputModel input)
        {
            var list = new List <Picture>();

            using (IDbConnection db = new SqlConnection(Global.Connection))
            {
                list = db.Query <Picture>("sp_SearchGetAvitoAddImage",
                                          new {
                    Prc_ID  = input.Prc_ID,
                    Cust_ID = input.Cust_ID,
                    AppCode = input.AppCode
                },
                                          commandType: CommandType.StoredProcedure).ToList();
            }
            return(list);
        }