Esempio n. 1
0
        public AddCompareOutputModel Save(AddCompareInputModel data)
        {
            CompareRepository repo = new CompareRepository(db);

            Compare temp = new Compare();

            string message = "";

            temp.CreateByUserID = data.UserID;
            temp.SiteID         = data.SiteID;
            temp.UserID         = data.UserID;
            temp.SiteItemID     = data.SiteItemID;

            var checkCompare = db.Compare.Where(x => x.UserID == data.UserID && x.DeletedDate == null).ToList();

            AddCompareOutputModel output = new AddCompareOutputModel();

            if (checkCompare.Count <= 3)
            {
                var res = repo.Insert(temp);
                output.SiteID = data.SiteID;
                message       = res.Message;
            }
            else
            {
                message = "Maksimal hanya 3 site";
            }

            output.Message = message;

            return(output);
        }
Esempio n. 2
0
        public ClearCompareOutputModel DeleteCompare(ClearCompareInputModel data)
        {
            CompareRepository repo = new CompareRepository(db);

            var res = repo.Delete(Guid.Empty, data.UserID);

            ClearCompareOutputModel output = new ClearCompareOutputModel();

            output.Message = "Compare sudah dihapus semua!";

            return(output);
        }
Esempio n. 3
0
        public DeleteCompareOutputModel DeleteCompare(DeleteCompareInputModel data)
        {
            CompareRepository repo = new CompareRepository(db);

            var res = repo.Delete(data.CompareID, data.UserID);

            DeleteCompareOutputModel output = new DeleteCompareOutputModel();

            output.CompareID = res.ID;

            return(output);
        }