partial void DeleteRecycler(Recycler instance);
 partial void InsertRecycler(Recycler instance);
 partial void UpdateRecycler(Recycler instance);
Exemple #4
0
        /// <summary>
        /// InsertRecycler
        /// </summary>
        /// <param name="name"></param>
        /// <param name="address"></param>
        /// <param name="wardName"></param>
        /// <param name="mobile"></param>
        /// <param name="password"></param>
        /// <param name="garbageType"></param>
        public void InsertRecycler(string name, string address, string wardName, string mobile, string password, string garbageType)
        {
            var ward = context.Wards.Where(@w => @w.Name == wardName).First();
            var garbageTypeSingle = context.GarbageTypes.Where(@w => @w.Type == garbageType).First();
            Guid recyclerId = Guid.NewGuid();

            InsertGarbageType(garbageTypeSingle.Id, recyclerId);

            Recycler recycler = new Recycler
            {
                Id = recyclerId,
                Name = name,
                Address = address,
                WardId = ward.Id,
                Mobile = mobile,
                Password = password
            };

            context.Recyclers.InsertOnSubmit(recycler);
            SubmitData();
        }