Ejemplo n.º 1
0
        public void settingAddProfileToCommunication(int userId, string keyDialog, int profileId)
        {
            var db                 = new MyDBModels.DB();
            var dateUtils          = new DateUtils();
            var communicationModel = db.communication.Where(c => c.KeyDialog == keyDialog).First();

            var participantProfileIdList = communicationModel.ParticipantProfileIdArray.ToList();

            participantProfileIdList.Add(profileId);
            communicationModel.ParticipantProfileIdArray = participantProfileIdList.ToArray();

            var addProfileTimestampList = communicationModel.AddProfileTimestampArray.ToList();

            addProfileTimestampList.Add(dateUtils.DateTimeToUnixTimeStamp(DateTime.Now));
            communicationModel.AddProfileTimestampArray = addProfileTimestampList.ToArray();

            var communicationIdArray = db.user.Where(u => u.ProfileId == profileId).First().CommunicationIdArray;
            var communicationIdList  = communicationIdArray.ToList();

            communicationIdList.Add(communicationModel.CommunicationId);
            db.user.Where(u => u.ProfileId == profileId).First().CommunicationIdArray = communicationIdList.ToArray();

            db.SaveChanges();

            var nameAddedProfile = db.profile.Where(p => p.ProfileId == profileId).First().Name;
            var messageAddId     = createSystemMessage(userId, String.Format("{0} {1}", "Added user", nameAddedProfile), 2);

            var messageIdList = communicationModel.MessageIdArray.ToList();

            messageIdList.Add(messageAddId);
            communicationModel.MessageIdArray = messageIdList.ToArray();

            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public void sendMessage(int userId, MessageSendModel model, string keyDialog)
        {
            var db        = new MyDBModels.DB();
            var user      = db.user.Where(u => u.UserId == userId).First();
            var profileId = user.ProfileId;

            var currentCommunication = db.communication.Where(c => c.KeyDialog == keyDialog).First();

            MyDBModels.Message messsage = new MyDBModels.Message();
            messsage.DataMessage     = model.DataMessage;
            messsage.TimeWritten     = model.TimeWritten;
            messsage.IsReadProfileId = new int[] { profileId };
            messsage.ProfileId       = profileId;
            messsage.TypeMessage     = 1;
            db.message.Add(messsage);
            db.SaveChanges();

            var messageIdArray = currentCommunication.MessageIdArray.ToList();

            messageIdArray.Add(db.message.Where(m => m.ProfileId == profileId && m.TimeWritten == model.TimeWritten).FirstOrDefault().MessageId);//OrderByDescending need?
            currentCommunication.MessageIdArray = messageIdArray.ToArray();

            var dataAccess = new CommunicationDataAccess();

            if (!currentCommunication.IsGroup)
            {
                var friendProfileId = currentCommunication.ParticipantProfileIdArray.Where(p => p != profileId).First();
                dataAccess.searchAndConnectOldCommunication(profileId, friendProfileId);
            }

            db.SaveChanges();
        }
Ejemplo n.º 3
0
        public void deleteCommunication(int userId, string keyDialog)
        {
            var db = new MyDBModels.DB();
            var communicationModel = db.communication.Where(c => c.KeyDialog == keyDialog).First();
            var userModel          = db.user.Where(u => u.UserId == userId).First();
            var profileId          = userModel.ProfileId;
            var dateUtils          = new DateUtils();
            //  removeCommunication(db, communicationModel, userModel.ProfileId);

            int indexProfile = Array.IndexOf(communicationModel.ParticipantProfileIdArray, profileId);

            var addProfileTimestampList = communicationModel.AddProfileTimestampArray.ToList();
            var timestamp = addProfileTimestampList.ElementAt(indexProfile);

            addProfileTimestampList.Remove(timestamp);
            addProfileTimestampList.Insert(indexProfile, dateUtils.DateTimeToUnixTimeStamp(DateTime.Now));
            communicationModel.AddProfileTimestampArray = addProfileTimestampList.ToArray();
            db.SaveChanges();

            var communicationIdArray = userModel.CommunicationIdArray;
            var communicationIdList  = communicationIdArray.ToList();

            communicationIdList.Remove(communicationModel.CommunicationId);
            userModel.CommunicationIdArray = communicationIdList.ToArray();

            if (db.user.Where(u => u.ProfileId == profileId).First().CommunicationPinIdArray.Contains(communicationModel.CommunicationId))
            {
                var communicationPinIdArray = userModel.CommunicationPinIdArray;
                var communicationPinIdList  = communicationPinIdArray.ToList();
                communicationPinIdList.Remove(communicationModel.CommunicationId);
                userModel.CommunicationPinIdArray = communicationPinIdList.ToArray();
            }

            db.SaveChanges();
        }
Ejemplo n.º 4
0
        public void confirmFriend(int userId, int confirmProfileId, bool addFriend)
        {
            var db              = new MyDBModels.DB();
            var myUserModel     = db.user.Where(u => u.UserId == userId).First();
            var myProfileModel  = db.profile.Where(p => p.ProfileId == myUserModel.ProfileId).First();
            var friendUserModel = db.user.Where(u => u.ProfileId == confirmProfileId).First();

            var possibleProfileIdArray = myUserModel.FriendPossibleIdArray;

            if (addFriend)
            {
                var friendArrayIdUpdate = myUserModel.FriendIdArray.ToList();
                friendArrayIdUpdate.Add(confirmProfileId);
                myUserModel.FriendIdArray = friendArrayIdUpdate.ToArray();

                var myFirendFriendArrayIdUpdate = friendUserModel.FriendIdArray.ToList();
                myFirendFriendArrayIdUpdate.Add(myUserModel.ProfileId);
                friendUserModel.FriendIdArray = myFirendFriendArrayIdUpdate.ToArray();

                if (friendUserModel.FriendPossibleIdArray.Contains(myUserModel.ProfileId))
                {
                    var firendPossibleArrayIdUpdate = friendUserModel.FriendPossibleIdArray.ToList();
                    firendPossibleArrayIdUpdate.Remove(myUserModel.ProfileId);
                    myUserModel.FriendPossibleIdArray = firendPossibleArrayIdUpdate.ToArray();
                }

                CommunicationDataAccess dataAccess = new CommunicationDataAccess();

                if (!dataAccess.searchAndConnectOldCommunication(myProfileModel.ProfileId, friendUserModel.ProfileId))
                {
                    CommunicationShortModel shortModel = new CommunicationShortModel();
                    var firendProfile = db.profile.Where(fp => fp.ProfileId == friendUserModel.ProfileId).First();

                    shortModel.Name     = String.Format("{0} {1} - {2} {3}", firendProfile.Name, firendProfile.LastName, myProfileModel.Name, myProfileModel.LastName);
                    shortModel.PhotoUrl = firendProfile.PhotoUrl;
                    shortModel.ParticipantProfileIdArray = new int[] { firendProfile.ProfileId, myUserModel.ProfileId };

                    dataAccess.createCommunication(userId, shortModel);

                    db.SaveChanges();
                }
            }

            var possibleArrayIdUpdate = possibleProfileIdArray.ToList();

            possibleArrayIdUpdate.Remove(confirmProfileId);
            myUserModel.FriendPossibleIdArray = possibleArrayIdUpdate.ToArray();

            db.SaveChanges();
        }
        private int everyDayStatisticsCreate(int userId, EveryDayProfileStatisticsModel model)
        {
            var db        = new MyDBModels.DB();
            var dateUtils = new DateUtils();
            var profileStatisticsModel = getStatisticsByUserId(db, userId);

            DateTime inputDate = model.TimeCreate;

            foreach (int everyDayId in profileStatisticsModel.EveryDayProfileStatisticsIdArray)
            {
                var modelEveryDay = db.everyDayProfileStatistics.Where(e => e.EveryDayProfileStatisticsId == everyDayId).First();
                if (modelEveryDay.TimeCreate.Year == inputDate.Year && modelEveryDay.TimeCreate.Month == inputDate.Month && modelEveryDay.TimeCreate.Day == inputDate.Day)
                {
                    return(modelEveryDay.EveryDayProfileStatisticsId);
                }
            }

            MyDBModels.EveryDayProfileStatistics everyDayStatistics = new MyDBModels.EveryDayProfileStatistics();
            everyDayStatistics.CountDistance = 0;
            everyDayStatistics.MiddleSpeed   = 0;
            everyDayStatistics.TimeInTrip    = new TimeSpan(0 * 10000000);
            everyDayStatistics.Calories      = 0;
            everyDayStatistics.TimeCreate    = DateTime.Now;

            db.everyDayProfileStatistics.Add(everyDayStatistics);
            db.SaveChanges();

            var lastStatisticsId = db.everyDayProfileStatistics.OrderByDescending(i => i.EveryDayProfileStatisticsId).FirstOrDefault().EveryDayProfileStatisticsId;

            var everyDayArrayStatisticsIdArray = profileStatisticsModel.EveryDayProfileStatisticsIdArray;
            int count = everyDayArrayStatisticsIdArray.Count();
            var everyDayArrayStatisticsIdArrayUpdate = new int[count + 1];

            Array.Copy(everyDayArrayStatisticsIdArray, everyDayArrayStatisticsIdArrayUpdate, count);
            everyDayArrayStatisticsIdArrayUpdate[count] = lastStatisticsId;

            profileStatisticsModel.EveryDayProfileStatisticsIdArray = everyDayArrayStatisticsIdArrayUpdate;

            /*правильнее
             * var everyDayArrayStatisticsIdArray = profileStatisticsModel.EveryDayProfileStatisticsIdArray.ToList();
             * everyDayArrayStatisticsIdArray.Add(db.everyDayProfileStatistics.OrderByDescending(i => i.EveryDayProfileStatisticsId).FirstOrDefault().EveryDayProfileStatisticsId);
             * profileStatisticsModel.EveryDayProfileStatisticsIdArra = everyDayArrayStatisticsIdArray.ToArray();
             */

            db.SaveChanges();

            return(lastStatisticsId);
        }
Ejemplo n.º 6
0
        public void postWork(Models.WorkListModel value)
        {
            var db = new MyDBModels.DB();

            MyDBModels.WorkList workList = new MyDBModels.WorkList();
            workList.DriverId             = value.DriverId;
            workList.BusId                = value.BusId;
            workList.SecondNameDispatcher = value.SecondNameDispatcher;
            workList.DateAction           = value.DateAction;
            db.workList.Add(workList);


            MyDBModels.Bus busModel = db.bus.Where(b => b.BusId == value.BusId).FirstOrDefault();
            string         title    = "Bus: " + busModel.BusNumber.ToString() + "/" + busModel.Model;
            string         info     = "Date: " + value.DateAction + "\nDispatcher: " + value.SecondNameDispatcher;

            string number = EncryptClass.DESEncrypt(db.driver.Where(b => b.DriverId == value.DriverId).FirstOrDefault().DriverNumber.ToString());

            MyDBModels.Account accountModel = db.account.Where(b => b.NumberWorker == number).FirstOrDefault();
            string             token        = accountModel.Token;

            sendRequestToFirebase("\"" + title + "\"", "\"" + info + "\"", "\"" + token + "\"");

            db.SaveChanges();
        }
Ejemplo n.º 7
0
        private void deleteFriendFromDb(MyDBModels.DB db, MyDBModels.User fromDeleteUserModel, int deleteProfileId)
        {
            var friendArrayIdUpdate = fromDeleteUserModel.FriendIdArray.ToList();

            friendArrayIdUpdate.Remove(deleteProfileId);
            fromDeleteUserModel.FriendIdArray = friendArrayIdUpdate.ToArray();

            var dataAccess      = new CommunicationDataAccess();
            int communicationId = dataAccess.searchCommunication(fromDeleteUserModel.ProfileId, deleteProfileId);

            var communicationIdArray = fromDeleteUserModel.CommunicationIdArray;
            var communicationIdList  = communicationIdArray.ToList();

            communicationIdList.Remove(communicationId);
            fromDeleteUserModel.CommunicationIdArray = communicationIdList.ToArray();

            if (fromDeleteUserModel.CommunicationPinIdArray.Contains(communicationId))
            {
                var communicationPinIdArray = fromDeleteUserModel.CommunicationPinIdArray;
                var communicationPinIdList  = communicationPinIdArray.ToList();
                communicationPinIdList.Remove(communicationId);
                fromDeleteUserModel.CommunicationPinIdArray = communicationPinIdList.ToArray();
            }

            db.SaveChanges();
        }
Ejemplo n.º 8
0
        private void removeCommunication(MyDBModels.DB db, MyDBModels.Communication communicationModel, int profileId)
        {
            var dateUtils          = new DateUtils();
            int indexRemoveProfile = Array.IndexOf(communicationModel.ParticipantProfileIdArray, profileId);

            var participantProfileIdList = communicationModel.ParticipantProfileIdArray.ToList();

            participantProfileIdList.Remove(profileId);
            communicationModel.ParticipantProfileIdArray = participantProfileIdList.ToArray();

            var addProfileTimestampList = communicationModel.AddProfileTimestampArray.ToList();

            addProfileTimestampList.Remove(communicationModel.AddProfileTimestampArray.ElementAt(indexRemoveProfile));
            communicationModel.AddProfileTimestampArray = addProfileTimestampList.ToArray();

            var userModel            = db.user.Where(u => u.ProfileId == profileId).First();
            var communicationIdArray = userModel.CommunicationIdArray;
            var communicationIdList  = communicationIdArray.ToList();

            communicationIdList.Remove(communicationModel.CommunicationId);
            userModel.CommunicationIdArray = communicationIdList.ToArray();

            if (db.user.Where(u => u.ProfileId == profileId).First().CommunicationPinIdArray.Contains(communicationModel.CommunicationId))
            {
                var communicationPinIdArray = userModel.CommunicationPinIdArray;
                var communicationPinIdList  = communicationPinIdArray.ToList();
                communicationPinIdList.Remove(communicationModel.CommunicationId);
                userModel.CommunicationPinIdArray = communicationPinIdList.ToArray();
            }

            db.SaveChanges();
        }
        private void saveToken(int userId, string token)
        {
            var db        = new MyDBModels.DB();
            var userModel = db.user.Where(u => u.UserId == userId).First();

            userModel.FirebaseToken = token;
            db.SaveChanges();
        }
Ejemplo n.º 10
0
        public void createCommunication(int userId, CommunicationShortModel model)
        {
            var db        = new MyDBModels.DB();
            var keyDailog = generateKeyDialog();
            var dateUtils = new DateUtils();
            var userModel = db.user.Where(u => u.UserId == userId).First();

            MyDBModels.Communication communication = new MyDBModels.Communication();

            communication.KeyDialog = keyDailog;
            communication.Name      = model.Name;
            communication.PhotoUrl  = model.PhotoUrl;
            communication.ParticipantProfileIdArray = model.ParticipantProfileIdArray;
            communication.CreaterProfileId          = userModel.ProfileId;
            communication.AddProfileTimestampArray  = Enumerable.Repeat(dateUtils.DateTimeToUnixTimeStamp(DateTime.Now), model.ParticipantProfileIdArray.Count()).ToArray();

            if (model.ParticipantProfileIdArray.Count() > 2)
            {
                communication.IsGroup = true;
            }

            else if (model.ParticipantProfileIdArray.Count() < 3)
            {
                foreach (int profileId in model.ParticipantProfileIdArray)
                {
                    var profile        = db.profile.Where(p => p.ProfileId == profileId).First();
                    var searchFullName = String.Format("{0} {1}", profile.Name, profile.LastName);
                    if (model.Name.Contains(searchFullName))
                    {
                        communication.IsGroup = false;
                        break;
                    }
                    else
                    {
                        communication.IsGroup = true;
                    }
                }
                ;
            }
            else
            {
                communication.IsGroup = false;
            }

            var systemMessageCreateId = createSystemMessage(userId, String.Format("{0} {1}", "Created communication", model.Name), 2);

            communication.MessageIdArray = new int[] { systemMessageCreateId };

            db.communication.Add(communication);
            db.SaveChanges();

            int communicationId = db.communication.Where(c => c.KeyDialog == keyDailog).First().CommunicationId;

            model.ParticipantProfileIdArray.ToList().ForEach(delegate(int profileId)
            {
                addCommunicationToUserByProfile(db, profileId, communicationId);
            });
        }
        private void updateLastActiveTime(int userId)
        {
            var db           = new MyDBModels.DB();
            var userModel    = db.user.Where(u => u.UserId == userId).First();
            var profileModel = db.profile.Where(p => p.ProfileId == userModel.ProfileId).First();

            profileModel.TimeLastActive = DateTime.Now;
            db.SaveChanges();
        }
        public void addArduino(int userId, ArduinoModel model)
        {
            var db = new MyDBModels.DB();

            MyDBModels.Arduino arduinoModel = new MyDBModels.Arduino();
            arduinoModel.Name = model.Name;
            arduinoModel.Mac  = model.Mac;

            db.arduino.Add(arduinoModel);
            db.SaveChanges();

            var arduinoArrayId = db.user.Where(u => u.UserId == userId).First().ArduinoIdArray.ToList();

            arduinoArrayId.Add(db.arduino.OrderByDescending(a => a.ArduinoId).FirstOrDefault().ArduinoId);

            db.user.Where(u => u.UserId == userId).First().ArduinoIdArray = arduinoArrayId.ToArray();
            db.SaveChanges();
        }
Ejemplo n.º 13
0
        public void addCommunicationToUserByProfile(MyDBModels.DB db, int profileId, int communicationId)
        {
            var userModel          = db.user.Where(u => u.ProfileId == profileId).First();
            var communicationArray = userModel.CommunicationIdArray.ToList();

            communicationArray.Add(communicationId);
            userModel.CommunicationIdArray = communicationArray.ToArray();

            db.SaveChanges();
        }
Ejemplo n.º 14
0
        public void postDate(Models.DateWorkListModel value)
        {
            var db = new MyDBModels.DB();

            MyDBModels.DateWorkList dateWorkList = new MyDBModels.DateWorkList();
            dateWorkList.DateAction = value.DateAction;
            dateWorkList.WorkListId = value.WorkListId;
            db.dateWorkList.Add(dateWorkList);
            db.SaveChanges();
        }
Ejemplo n.º 15
0
        public void settingChangeInfoCommunication(int userId, string keyDialog, CommunicationChangeModel model)
        {
            var db = new MyDBModels.DB();
            var communicationModel = db.communication.Where(c => c.KeyDialog == keyDialog).First();

            communicationModel.Name     = model.Name;
            communicationModel.PhotoUrl = model.Photourl;

            db.SaveChanges();
        }
Ejemplo n.º 16
0
        public void deleteDate(int id)
        {
            var db = new MyDBModels.DB();

            MyDBModels.DateWorkList dateWorkList = db.dateWorkList.Where(dwl => dwl.DateId == id).FirstOrDefault();
            if (dateWorkList != null)
            {
                db.dateWorkList.Remove(dateWorkList);
                db.SaveChanges();
            }
        }
Ejemplo n.º 17
0
        // DELETE api/values/
        public void Delete(int id)
        {
            var db = new MyDBModels.DB();

            MyDBModels.Bus bus = db.bus.Where(b => b.BusId == id).FirstOrDefault();
            if (bus != null)
            {
                db.bus.Remove(bus);
                db.SaveChanges();
            }
        }
Ejemplo n.º 18
0
        // DELETE api/values/
        public void Delete(int id)
        {
            var db = new MyDBModels.DB();

            MyDBModels.GasList gasList = db.gasList.Where(gl => gl.GasListId == id).FirstOrDefault();
            if (gasList != null)
            {
                db.gasList.Remove(gasList);
                db.SaveChanges();
            }
        }
Ejemplo n.º 19
0
        public void deleteDriver(int id)
        {
            var db = new MyDBModels.DB();

            MyDBModels.Driver driver = db.driver.Where(d => d.DriverId == id).FirstOrDefault();
            if (driver != null)
            {
                db.driver.Remove(driver);
                db.SaveChanges();
            }
        }
Ejemplo n.º 20
0
        // DELETE api/values/
        public void Delete(int id)
        {
            var db = new MyDBModels.DB();

            MyDBModels.RepairList repairList = db.repairList.Where(rl => rl.ListServiceId == id).FirstOrDefault();
            if (repairList != null)
            {
                db.repairList.Remove(repairList);
                db.SaveChanges();
            }
        }
Ejemplo n.º 21
0
        // POST api/values
        public void Post(Models.BusModel newbus)
        {
            var db = new MyDBModels.DB();

            MyDBModels.Bus bus = new MyDBModels.Bus();
            bus.BusCondition = newbus.Condition;
            bus.BusNumber    = newbus.BusNomber;
            bus.Model        = newbus.Model;
            db.bus.Add(bus);
            db.SaveChanges();
        }
Ejemplo n.º 22
0
        public void deleteWork(int id)
        {
            var db = new MyDBModels.DB();

            MyDBModels.WorkList workList = db.workList.Where(wl => wl.WorkListId == id).FirstOrDefault();
            if (workList != null)
            {
                db.workList.Remove(workList);
                db.SaveChanges();
            }
        }
Ejemplo n.º 23
0
        // POST api/values
        public void Post(Models.RepairListModel value)
        {
            var db = new MyDBModels.DB();

            MyDBModels.RepairList repairList = new MyDBModels.RepairList();
            repairList.BusId        = value.BusId;
            repairList.BusCondition = value.BusCondition;
            repairList.TimeGet      = value.TimeGet;
            db.repairList.Add(repairList);
            db.SaveChanges();
        }
Ejemplo n.º 24
0
        public void postDriver(Models.DriverModel value)
        {
            var db = new MyDBModels.DB();

            MyDBModels.Driver driver = new MyDBModels.Driver();
            driver.Secondname    = value.Secondname;
            driver.Qualification = value.Qualification;
            driver.Experience    = value.Experience;
            driver.Salary        = value.Salary;
            db.driver.Add(driver);
            db.SaveChanges();
        }
Ejemplo n.º 25
0
        public void postWork(Models.WorkListModel value)
        {
            var db = new MyDBModels.DB();

            MyDBModels.WorkList workList = new MyDBModels.WorkList();
            workList.DriverId             = value.DriverId;
            workList.BusId                = value.BusId;
            workList.SecondNameDispatcher = value.SecondNameDispatcher;
            workList.DateAction           = value.DateAction;
            db.workList.Add(workList);
            db.SaveChanges();
        }
Ejemplo n.º 26
0
        // POST api/values
        public void Post(Models.GasListModel value)
        {
            var db = new MyDBModels.DB();

            MyDBModels.GasList gasList = new MyDBModels.GasList();
            gasList.BusId      = value.BusId;
            gasList.CostGas    = value.CostGas;
            gasList.CountLitre = value.CountLitre;
            gasList.TimeGet    = value.TimeGet;
            db.gasList.Add(gasList);
            db.SaveChanges();
        }
Ejemplo n.º 27
0
        public void clearHistory(int userId, string keyDialog)
        {
            var db                      = new MyDBModels.DB();
            var dateUtils               = new DateUtils();
            var communicationModel      = db.communication.Where(c => c.KeyDialog == keyDialog).First();
            int indexProfile            = Array.IndexOf(communicationModel.ParticipantProfileIdArray, db.user.Where(u => u.UserId == userId).First().ProfileId);
            var addProfileTimestampList = communicationModel.AddProfileTimestampArray.ToList();
            var timestamp               = addProfileTimestampList.ElementAt(indexProfile);

            addProfileTimestampList.Remove(timestamp);
            addProfileTimestampList.Insert(indexProfile, dateUtils.DateTimeToUnixTimeStamp(DateTime.Now));
            communicationModel.AddProfileTimestampArray = addProfileTimestampList.ToArray();
            db.SaveChanges();

            var messageAddId  = createSystemMessage(userId, "History was cleared", 3);
            var messageIdList = communicationModel.MessageIdArray.ToList();

            messageIdList.Add(messageAddId);
            communicationModel.MessageIdArray = messageIdList.ToArray();

            db.SaveChanges();
        }
Ejemplo n.º 28
0
        public void postRepair(Models.RepairListModel value, int number)
        {
            var db       = new MyDBModels.DB();
            int idDriver = db.driver.Where(d => d.DriverNumber == number).FirstOrDefault().DriverId;

            MyDBModels.WorkList work = db.workList.Where(d => d.DriverId == idDriver && d.DateAction == value.TimeGet).FirstOrDefault();

            MyDBModels.RepairList repairList = new MyDBModels.RepairList();
            repairList.BusId        = work.BusId;
            repairList.BusCondition = value.BusCondition;
            repairList.TimeGet      = value.TimeGet;
            db.repairList.Add(repairList);
            db.SaveChanges();
        }
Ejemplo n.º 29
0
        private void deleteMessageItem(int messageId, string keyDialog)
        {
            var db            = new MyDBModels.DB();
            var messageDelete = db.message.Where(m => m.MessageId == messageId).First();

            var currentCommunication = db.communication.Where(c => c.KeyDialog == keyDialog).First();
            var messageIdArray       = currentCommunication.MessageIdArray.ToList();

            messageIdArray.Remove(messageId);
            currentCommunication.MessageIdArray = messageIdArray.ToArray();

            db.message.Remove(messageDelete);
            db.SaveChanges();
        }
Ejemplo n.º 30
0
        public void postDispatcher(Models.DispatcherAccountModel postDispatcher)
        {
            var db = new MyDBModels.DB();

            MyDBModels.Account account = new MyDBModels.Account();

            account.LoginId        = postDispatcher.AccountModel.Secondname;
            account.PasswordWorker = postDispatcher.AccountModel.Password;
            account.RoleWorker     = postDispatcher.AccountModel.Role;
            account.NumberWorker   = postDispatcher.AccountModel.Number;

            db.account.Add(account);
            db.SaveChanges();
        }