Exemple #1
0
        /// <summary>
        /// ثبت یک لاگ جدید
        /// </summary>
        /// <param name="vm"></param>
        /// <returns></returns>
        public int CreateLog(CreateRoutine2LogViewModel vm)
        {
            // map the ViewModel to a new entity
            var entity = Mapper.Map <Routine2Log>(vm);

            // Add it to database
            DbContext.Routine2Log.Add(entity);
            DbContext.SaveChanges();

            // return the new id
            return(entity.Id);
        }
Exemple #2
0
        public ServiceResult <int> CreateLog(CreateRoutine2LogViewModel vm)
        {
            // map the ViewModel to a new entity

            var entity = Mapper.Map <Routine2Log>(vm);

            // Add it to database
            _context.Routine2Log.Add(entity);
            _context.SaveChanges();

            // return the new id
            return(ServiceResult <int> .Okay(entity.Id));
        }