Example #1
0
        private YarnService CreateYarnService()
        {
            var userId  = Guid.Parse(User.Identity.GetUserId());
            var service = new YarnService(userId);

            return(service);
        }
Example #2
0
        // GET: Yarn
        public ActionResult Index()
        {
            var ownerId = Guid.Parse(User.Identity.GetUserId());
            var service = new YarnService(ownerId);
            var model   = service.GetYarns();

            return(View(model));
        }
        public IEnumerable <ValidationResult> Validate(ValidationContext validationContext)
        {
            YarnService service = validationContext.GetService <YarnService>();

            if (service.DbSet.Count(r => r.Id != this.Id && r.Name.Equals(this.Name) && r._IsDeleted.Equals(false)) > 0)
            {
                yield return(new ValidationResult("Nama Benang sudah ada", new List <string> {
                    "Name"
                }));
            }
        }
 public YarnServiceDataUtil(SpinningDbContext dbContext, YarnService yarnService)
 {
     this.DbContext   = dbContext;
     this.YarnService = yarnService;
 }